aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@celest.fr>2010-04-20 22:25:16 +0200
committerThomas Preud'homme <thomas.preudhomme@celest.fr>2010-04-20 22:25:16 +0200
commita64a6f36a04f7955eb33966a351280ff764fdd2b (patch)
treed429272ea357a7d70a1c63fcdb348cf843f9042e /tccelf.c
parent6525a15919dd41a6a518b76451a4139ea5dabf6c (diff)
downloadtinycc-a64a6f36a04f7955eb33966a351280ff764fdd2b.tar.gz
tinycc-a64a6f36a04f7955eb33966a351280ff764fdd2b.tar.bz2
Replace malloc+strcpy by tcc_strdup in ld_load_file_list
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/tccelf.c b/tccelf.c
index 8d47e1a..a35206e 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -2944,15 +2944,9 @@ static int ld_add_file_list(TCCState *s1, const char *cmd, int as_needed)
if (ret)
goto lib_parse_error;
if (group) {
- char *file_name, *lib_name;
-
- /* Add the filename and the libname to avoid future conversions */
- file_name = tcc_malloc(sizeof(char) * (strlen(filename) + 1));
- strcpy(file_name, filename);
- dynarray_add((void ***) &libs, &nblibs, file_name);
- lib_name = tcc_malloc(sizeof(char) * (strlen(libname) + 1));
- strcpy(lib_name, libname);
- dynarray_add((void ***) &libs, &nblibs, lib_name);
+ /* Add the filename *and* the libname to avoid future conversions */
+ dynarray_add((void ***) &libs, &nblibs, tcc_strdup(filename));
+ dynarray_add((void ***) &libs, &nblibs, tcc_strdup(libname));
}
}
}