Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2019-11-21 22:38:59 +1000
committerAllan McRae <allan@archlinux.org>2019-11-21 22:42:23 +1000
commit8846574eda51cb48b3c3a462abb8bb9b61b7e10b (patch)
tree449076125ee7bb2ebcc83016fa54edfec6a0e4d9
parenteaa2770c80f8f3b168b99021e4258d696523d38a (diff)
Fix leak in _alpm_db_search on error condition
-rw-r--r--lib/libalpm/db.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index cf4c865f..43ca1fc8 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -422,7 +422,10 @@ int _alpm_db_search(alpm_db_t *db, const alpm_list_t *needles,
_alpm_log(db->handle, ALPM_LOG_DEBUG, "searching for target '%s'\n", targ);
if(regcomp(&reg, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
- RET_ERR(db->handle, ALPM_ERR_INVALID_REGEX, -1);
+ db->handle->pm_errno = ALPM_ERR_INVALID_REGEX;
+ alpm_list_free(list);
+ alpm_list_free(*ret);
+ return -1;
}
for(j = list; j; j = j->next) {