[pacman-dev] [PATCH] Ensure regex object is always initialized

Dave Reisner dreisner at archlinux.org
Tue Dec 24 12:45:19 UTC 2019


This avoids a crash in filetarget_free() when regex support isn't
requested in files_search().
---
 src/pacman/files.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pacman/files.c b/src/pacman/files.c
index 7b0c884b..29b593be 100644
--- a/src/pacman/files.c
+++ b/src/pacman/files.c
@@ -114,7 +114,7 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
 		char *targ = t->data;
 		size_t len = strlen(targ);
 		int exact_file = strchr(targ, '/') != NULL;
-		regex_t reg;
+		regex_t reg = {};
 
 		if(exact_file) {
 			while(len > 1 && targ[0] == '/') {
-- 
2.24.1


More information about the pacman-dev mailing list