mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
pacman/upgrade: Check malloc() return value
Check the return value of malloc() before dereferencing the returned pointer. Signed-off-by: Sören Brinkmann <soeren.brinkmann@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
912ea363de
commit
3ebb7b94d9
@ -51,6 +51,10 @@ int pacman_upgrade(alpm_list_t *targets)
|
|||||||
*/
|
*/
|
||||||
for(i = targets; i; i = alpm_list_next(i)) {
|
for(i = targets; i; i = alpm_list_next(i)) {
|
||||||
int *r = malloc(sizeof(int));
|
int *r = malloc(sizeof(int));
|
||||||
|
if(r == NULL) {
|
||||||
|
pm_printf(ALPM_LOG_ERROR, _("memory exhausted\n"));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if(strstr(i->data, "://")) {
|
if(strstr(i->data, "://")) {
|
||||||
char *str = alpm_fetch_pkgurl(config->handle, i->data);
|
char *str = alpm_fetch_pkgurl(config->handle, i->data);
|
||||||
|
Loading…
Reference in New Issue
Block a user