1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

lib/libalpm/dload.c: Use STRDUP() instead of strdup()

Use the STRDUP macro instead of strdup() for the sake of better error
handling on memory allocation failures.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Lukas Fleischer 2011-08-18 09:42:20 +02:00 committed by Dan McGee
parent 0745288c14
commit d18e600952

View File

@ -387,10 +387,12 @@ cleanup:
tempfile, destfile, strerror(errno));
ret = -1;
} else if(final_file) {
*final_file = strdup(strrchr(destfile, '/') + 1);
STRDUP(*final_file, strrchr(destfile, '/') + 1,
RET_ERR(handle, ALPM_ERR_MEMORY, -1));
}
} else if(final_file) {
*final_file = strdup(strrchr(tempfile, '/') + 1);
STRDUP(*final_file, strrchr(tempfile, '/') + 1,
RET_ERR(handle, ALPM_ERR_MEMORY, -1));
}
}
@ -457,7 +459,7 @@ char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url)
CALLOC(payload, 1, sizeof(*payload), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
payload->handle = handle;
payload->fileurl = strdup(url);
STRDUP(payload->fileurl, url, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
payload->allow_resume = 1;
/* download the file */