From: Xiaoming Ni Date: Fri, 4 Nov 2022 09:30:00 +0000 (+0800) Subject: elf/tlsdeschtab.h: Add the Malloc return value check in _dl_make_tlsdesc_dynamic() X-Git-Tag: glibc-2.37~177 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1d0162e50afe7fa1e2fc4a901eb411db48acd7b;p=thirdparty%2Fglibc.git elf/tlsdeschtab.h: Add the Malloc return value check in _dl_make_tlsdesc_dynamic() Check the return value of malloc based on the function header comment of _dl_make_tlsdesc_dynamic(). If the return value fails, NULL is returned. Signed-off-by: Xiaoming Ni Reviewed-by: Szabolcs Nagy --- diff --git a/elf/tlsdeschtab.h b/elf/tlsdeschtab.h index 8c02e45a49d..82733159e37 100644 --- a/elf/tlsdeschtab.h +++ b/elf/tlsdeschtab.h @@ -110,6 +110,8 @@ _dl_make_tlsdesc_dynamic (struct link_map *map, size_t ti_offset) } *entry = td = malloc (sizeof (struct tlsdesc_dynamic_arg)); + if (! td) + return 0; /* This may be higher than the map's generation, but it doesn't matter much. Worst case, we'll have one extra DTV update per thread. */