From: ChenChen Zhou <357726167@qq.com> Date: Thu, 24 Nov 2022 13:59:21 +0000 (+0800) Subject: Fix profile crash on memory exhaustion X-Git-Tag: krb5-1.21-beta1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2929ec400c174bc848a9c438a61b0e3506b91d0e;p=thirdparty%2Fkrb5.git Fix profile crash on memory exhaustion In profile_get_values(), if init_list() fails to allocate values.list, end_list() will dereference a null pointer. Fix end_list() to handle list->list being null. [ghudson@mit.edu: rewrote commit message] ticket: 9078 (new) --- diff --git a/src/util/profile/prof_get.c b/src/util/profile/prof_get.c index 0e14200cab..12c7b9641d 100644 --- a/src/util/profile/prof_get.c +++ b/src/util/profile/prof_get.c @@ -62,7 +62,7 @@ static void end_list(struct profile_string_list *list, char ***ret_list) *ret_list = list->list; return; } else { - for (cp = list->list; *cp; cp++) + for (cp = list->list; cp && *cp; cp++) free(*cp); free(list->list); }