1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

_alpm_dep_dup: free memory on error

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2014-12-22 00:08:24 +10:00
parent f4796c905c
commit e892234207

View File

@ -527,13 +527,17 @@ alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep)
alpm_depend_t *newdep; alpm_depend_t *newdep;
CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL); CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL);
STRDUP(newdep->name, dep->name, return NULL); STRDUP(newdep->name, dep->name, goto error);
STRDUP(newdep->version, dep->version, return NULL); STRDUP(newdep->version, dep->version, goto error);
STRDUP(newdep->desc, dep->desc, return NULL); STRDUP(newdep->desc, dep->desc, goto error);
newdep->name_hash = dep->name_hash; newdep->name_hash = dep->name_hash;
newdep->mod = dep->mod; newdep->mod = dep->mod;
return newdep; return newdep;
error:
alpm_dep_free(newdep);
return NULL;
} }
/* These parameters are messy. We check if this package, given a list of /* These parameters are messy. We check if this package, given a list of