Browse Source

regex: reset pointer after free to avoid double free if an error occurs

Daniel-Constantin Mierla 10 năm trước cách đây
mục cha
commit
379667e878
1 tập tin đã thay đổi với 1 bổ sung0 xóa
  1. 1 0
      modules/regex/regex_mod.c

+ 1 - 0
modules/regex/regex_mod.c

@@ -411,6 +411,7 @@ static int load_pcres(int action)
 		memcpy(pcres_tmp[i], pcre_tmp, pcre_size);
 		pcre_free(pcre_tmp);
 		pkg_free(patterns[i]);
+		patterns[i] = NULL;
 	}
 	
 	/* Copy to shared memory */