Skip to content

Commit

Permalink
Fix profile crash on memory exhaustion
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
HelloCarry authored and greghudson committed Dec 5, 2022
1 parent d864d74 commit 2929ec4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/profile/prof_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 2929ec4

Please sign in to comment.