[pacman-dev] [PATCH] build_payload: free memory on error

Allan McRae allan at archlinux.org
Sun Dec 21 13:52:21 UTC 2014


Signed-off-by: Allan McRae <allan at archlinux.org>
---
 lib/libalpm/sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index c513b6b..3664675 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -862,7 +862,7 @@ static struct dload_payload *build_payload(alpm_handle_t *handle,
 		struct dload_payload *payload;
 
 		CALLOC(payload, 1, sizeof(*payload), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
-		STRDUP(payload->remote_name, filename, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
+		STRDUP(payload->remote_name, filename, FREE(payload); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 		payload->max_size = size;
 		payload->servers = servers;
 		return payload;
-- 
2.2.0


More information about the pacman-dev mailing list