Merge pull request #2430 from ianyfan/socketpath-leaks

Fix memory leaks in get_socketpath
This commit is contained in:
Drew DeVault 2018-08-06 14:08:51 -04:00 committed by GitHub
commit 1818c58e40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,7 @@ char *get_socketpath(void) {
if (line && *line) { if (line && *line) {
return line; return line;
} }
free(line);
} }
const char *i3sock = getenv("I3SOCK"); const char *i3sock = getenv("I3SOCK");
if (i3sock) { if (i3sock) {
@ -37,6 +38,7 @@ char *get_socketpath(void) {
if (line && *line) { if (line && *line) {
return line; return line;
} }
free(line);
} }
return NULL; return NULL;
} }