]> git.sur5r.net Git - i3/i3/commitdiff
Fix memleak: free regex when parsing fails
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 28 Aug 2017 07:22:38 +0000 (09:22 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 28 Aug 2017 07:22:56 +0000 (09:22 +0200)
fixes #2541

src/regex.c

index 296b91dd10cf24b03966779c522a5627f3250036..8f039157f6f7547d57e66733aa4bffdb23f72345 100644 (file)
@@ -38,6 +38,7 @@ struct regex *regex_new(const char *pattern) {
         }
         ELOG("PCRE regular expression compilation failed at %d: %s\n",
              offset, error);
+        regex_free(re);
         return NULL;
     }
     re->extra = pcre_study(re->regex, 0, &error);