diff options
Diffstat (limited to 'src/lib/kadm5/srv/svr_principal.c')
-rw-r--r-- | src/lib/kadm5/srv/svr_principal.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/kadm5/srv/svr_principal.c b/src/lib/kadm5/srv/svr_principal.c index f4a21f3..5ff1b49 100644 --- a/src/lib/kadm5/srv/svr_principal.c +++ b/src/lib/kadm5/srv/svr_principal.c @@ -964,9 +964,14 @@ static kadm5_ret_t add_to_history(krb5_context context, /* resize the adb->old_keys array if necessary */ if (adb->old_key_len < pol->pw_history_num-1) { - adb->old_keys = (osa_pw_hist_ent *) - realloc(adb->old_keys, - (adb->old_key_len+1)*sizeof(osa_pw_hist_ent)); + if (adb->old_keys == NULL) { + adb->old_keys = (osa_pw_hist_ent *) + malloc((adb->old_key_len + 1) * sizeof (osa_pw_hist_ent)); + } else { + adb->old_keys = (osa_pw_hist_ent *) + realloc(adb->old_keys, + (adb->old_key_len + 1) * sizeof (osa_pw_hist_ent)); + } if (adb->old_keys == NULL) return(ENOMEM); |