From 0eda92c5d4f8810a68066ee72713ffdfa878dd8c Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 13 Apr 2020 17:39:35 +1000 Subject: Use STRDUP for error checking in more places Use STRDUP() over strdup() to catch memory allocation errors. There are still some instances of strdup left, but these are in functions that currently have no error path and would require a larger rework. Signed-off-by: Allan McRae --- lib/libalpm/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libalpm/util.c') diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index cebc87ec..cb838e43 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -350,7 +350,8 @@ int _alpm_unpack(alpm_handle_t *handle, const char *path, const char *prefix, /* If specific files were requested, skip entries that don't match. */ if(list) { - char *entry_prefix = strdup(entryname); + char *entry_prefix = NULL; + STRDUP(entry_prefix, entryname, ret = 1; goto cleanup); char *p = strstr(entry_prefix,"/"); if(p) { *(p + 1) = '\0'; -- cgit v1.2.3-54-g00ecf