summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2014-12-24 02:59:55 +0100
committerAllan McRae <allan@archlinux.org>2014-12-27 08:08:32 +0100
commit32413213cb3aa532f64bd19024f9694a22875e21 (patch)
tree469956ac6a69bf410c255d819ae0a454c1679c4d /lib/libalpm
parentd5e93e895bdb3705f2baf83efcc7d56e86d927ed (diff)
downloadpacman-32413213cb3aa532f64bd19024f9694a22875e21.tar.gz
pacman-32413213cb3aa532f64bd19024f9694a22875e21.tar.xz
apply_deltas: fix memory leak on error
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/sync.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 36646759..e19655d9 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -736,11 +736,11 @@ static int apply_deltas(alpm_handle_t *handle)
} else {
/* len = cachedir len + from len + '/' + null */
len = strlen(cachedir) + strlen(d->from) + 2;
- MALLOC(from, len, RET_ERR(handle, ALPM_ERR_MEMORY, 1));
+ MALLOC(from, len, free(delta); RET_ERR(handle, ALPM_ERR_MEMORY, 1));
snprintf(from, len, "%s/%s", cachedir, d->from);
}
len = strlen(cachedir) + strlen(d->to) + 2;
- MALLOC(to, len, free(from); RET_ERR(handle, ALPM_ERR_MEMORY, 1));
+ MALLOC(to, len, free(delta); free(from); RET_ERR(handle, ALPM_ERR_MEMORY, 1));
snprintf(to, len, "%s/%s", cachedir, d->to);
/* build the patch command */