[pacman-dev] [PATCH] pacman/files.c: fix memory leak on regex error

Allan McRae allan at archlinux.org
Mon Jul 20 03:42:24 UTC 2015


Signed-off-by: Allan McRae <allan at archlinux.org>
---
 src/pacman/files.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pacman/files.c b/src/pacman/files.c
index 2250994..ceec342 100644
--- a/src/pacman/files.c
+++ b/src/pacman/files.c
@@ -102,6 +102,7 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
 		if(regex) {
 			if(regcomp(&reg, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
 				/* TODO: error message */
+				free(targ);
 				goto notfound;
 			}
 		}
-- 
2.4.6


More information about the pacman-dev mailing list