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

_alpm_delta_dup: free memory on error

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2014-12-21 23:45:24 +10:00
parent eb7cc246c6
commit bf06efaa78

View File

@ -342,14 +342,18 @@ alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta)
{
alpm_delta_t *newdelta;
CALLOC(newdelta, 1, sizeof(alpm_delta_t), return NULL);
STRDUP(newdelta->delta, delta->delta, return NULL);
STRDUP(newdelta->delta_md5, delta->delta_md5, return NULL);
STRDUP(newdelta->from, delta->from, return NULL);
STRDUP(newdelta->to, delta->to, return NULL);
STRDUP(newdelta->delta, delta->delta, goto error);
STRDUP(newdelta->delta_md5, delta->delta_md5, goto error);
STRDUP(newdelta->from, delta->from, goto error);
STRDUP(newdelta->to, delta->to, goto error);
newdelta->delta_size = delta->delta_size;
newdelta->download_size = delta->download_size;
return newdelta;
error:
_alpm_delta_free(newdelta);
return NULL;
}
/* vim: set noet: */