Merge pull request #2888 from stapelberg/leak

Fix memory leak
This commit is contained in:
Michael Stapelberg 2017-08-28 12:07:40 +02:00 committed by GitHub
commit f41ae5a88f
2 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,10 @@
#include <libgen.h> #include <libgen.h>
#include "shmlog.h" #include "shmlog.h"
#ifdef I3_ASAN_ENABLED
#include <sanitizer/lsan_interface.h>
#endif
#include "sd-daemon.h" #include "sd-daemon.h"
/* The original value of RLIMIT_CORE when i3 was started. We need to restore /* The original value of RLIMIT_CORE when i3 was started. We need to restore
@ -551,6 +555,9 @@ int main(int argc, char *argv[]) {
xcb_generic_error_t *error = xcb_request_check(conn, cookie); xcb_generic_error_t *error = xcb_request_check(conn, cookie);
if (error != NULL) { if (error != NULL) {
ELOG("Another window manager seems to be running (X error %d)\n", error->error_code); ELOG("Another window manager seems to be running (X error %d)\n", error->error_code);
#ifdef I3_ASAN_ENABLED
__lsan_do_leak_check();
#endif
return 1; return 1;
} }

View File

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