diff options
author | Daniel Gustafsson <daniel@yesql.se> | 2018-12-13 10:15:00 +0100 |
---|---|---|
committer | Daniel Gustafsson <daniel@yesql.se> | 2018-12-13 10:15:00 +0100 |
commit | a58b27740fd78fee88b35104fa71b7019280ccff (patch) | |
tree | 0dc220787d954029b296d5797d161d609aa42f22 /tests/unit/unit1602.c | |
parent | 7a09b52c98ac8d840a8a9907b1a1d9a9e684bcf5 (diff) |
OS400: handle memory error in list conversion
Curl_slist_append_nodup() returns NULL when it fails to create a new
item for the specified list, and since the coding here reassigned the
new list on top of the old list it would result in a dangling pointer
and lost memory. Also, in case we hit an allocation failure at some
point during the conversion, with allocation succeeding again on the
subsequent call(s) we will return a truncated list around the malloc
failure point. Fix by assigning to a temporary list pointer, which can
be checked (which is the common pattern for slist appending), and free
all the resources on allocation failure.
Closes #3372
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
Diffstat (limited to 'tests/unit/unit1602.c')
0 files changed, 0 insertions, 0 deletions