[pacman-dev] [PATCH 3/5] _alpm_runscriptlet: free memory on error

Allan McRae allan at archlinux.org
Wed Dec 24 01:01:39 UTC 2014


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

diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 7cdb096..e680feb 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -343,7 +343,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath,
 
 	/* either extract or copy the scriptlet */
 	len += strlen("/.INSTALL");
-	MALLOC(scriptfn, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
+	MALLOC(scriptfn, len, free(tmpdir); RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 	snprintf(scriptfn, len, "%s/.INSTALL", tmpdir);
 	if(is_archive) {
 		if(_alpm_unpack_single(handle, filepath, tmpdir, ".INSTALL")) {
-- 
2.2.1


More information about the pacman-dev mailing list