[pacman-dev] [PATCHv2 1/2] Ensure regex object is always initialized

Dave Reisner dreisner at archlinux.org
Tue Dec 24 23:17:47 UTC 2019


This avoids a crash in filetarget_free() when regex support isn't
requested in files_search().
---
v2: Use {0} instead of {}. The former is c99, the latter is a GNU
extension.

 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..cae7130d 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 = {0};
 
 		if(exact_file) {
 			while(len > 1 && targ[0] == '/') {
-- 
2.24.1


More information about the pacman-dev mailing list