summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChenChen Zhou <357726167@qq.com>2022-11-24 21:59:21 +0800
committerGreg Hudson <ghudson@mit.edu>2022-12-05 11:19:05 -0500
commit2929ec400c174bc848a9c438a61b0e3506b91d0e (patch)
tree476be17a2cf913d52930e0721d467bcaeb5f33f5
parentd864d740d019fdf2c640460f2aa2760c7fa4d5e9 (diff)
downloadkrb5-2929ec400c174bc848a9c438a61b0e3506b91d0e.tar.gz
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)
-rw-r--r--src/util/profile/prof_get.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/profile/prof_get.c b/src/util/profile/prof_get.c
index 0e14200ca..12c7b9641 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);
}