From 964640fbfcde48b7937a6c18964c78a3b11db3de Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Sat, 24 Nov 2012 13:15:04 -0500 Subject: Plug various minor memory leaks Signed-off-by: Andrew Gregory Signed-off-by: Allan McRae --- lib/libalpm/be_local.c | 1 + lib/libalpm/dload.c | 1 + lib/libalpm/sync.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index bbc0a8ac..f0e4a80f 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -943,6 +943,7 @@ int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info) dirp = opendir(pkgpath); if(!dirp) { + free(pkgpath); return -1; } /* go through the local DB entry, removing the files within, which we know diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 6aaff1d2..3e1659e7 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -358,6 +358,7 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat CLOSE(fd); _alpm_log(payload->handle, ALPM_LOG_ERROR, _("failed to create temporary file for download\n")); + free(randpath); return NULL; } /* fp now points to our alpmtmp.XXXXXX */ diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 841e5d6f..a4e58605 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -698,7 +698,7 @@ static int apply_deltas(alpm_handle_t *handle) snprintf(from, len, "%s/%s", cachedir, d->from); } len = strlen(cachedir) + strlen(d->to) + 2; - MALLOC(to, len, RET_ERR(handle, ALPM_ERR_MEMORY, 1)); + MALLOC(to, len, free(from); RET_ERR(handle, ALPM_ERR_MEMORY, 1)); snprintf(to, len, "%s/%s", cachedir, d->to); /* build the patch command */ -- cgit v1.2.3-54-g00ecf