From: Nick Alcock Date: Tue, 7 Mar 2017 23:27:12 +0000 (+0000) Subject: ctf: strdup() -> xstrdup() X-Git-Tag: v4.1.12-102.0.20170529_2200~57^2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=566e56ebd29a1f694ac1dbfda29b4597eab0539f;p=users%2Fjedix%2Flinux-maple.git ctf: strdup() -> xstrdup() Several unadorned strdup()s have crept into dwarf2ctf: all of them should be xstrdup(), since none are handling malloc failure themselves. Orabug: 25815306 Signed-off-by: Nick Alcock Reviewed-by: tomas.jedlicka@oracle.com --- diff --git a/scripts/dwarf2ctf/dwarf2ctf.c b/scripts/dwarf2ctf/dwarf2ctf.c index 9ce11ea2518a..2332501c317a 100644 --- a/scripts/dwarf2ctf/dwarf2ctf.c +++ b/scripts/dwarf2ctf/dwarf2ctf.c @@ -1103,7 +1103,7 @@ static void init_dedup_blacklist(const char *dedup_blacklist_file) line[len-1] = '\0'; - g_hash_table_insert(dedup_blacklist, strdup(line), NULL); + g_hash_table_insert(dedup_blacklist, xstrdup(line), NULL); } if (ferror(f)) { @@ -1999,8 +1999,8 @@ static void detect_duplicates_will_rescan(Dwarf_Die *die, const char *id, fprintf(stderr, "Out of memory allocating id_file\n"); exit (1); } - id_file->file_name = strdup(state->file_name); - id_file->id = strdup(id); + id_file->file_name = xstrdup(state->file_name); + id_file->id = xstrdup(id); id_file->dieoff = dwarf_dieoffset(die); state->named_structs = g_slist_prepend(state->named_structs, id_file); } @@ -4059,7 +4059,7 @@ static char *rel_abs_file_name(const char *file_name, const char *relative_to) abspath = realpath(file_name, NULL); if (abspath == NULL) - abspath = strdup(file_name); + abspath = xstrdup(file_name); if ((dir > -1) && (fchdir(dir) < 0)) { fprintf(stderr, "Cannot return to original directory "