Fix wrong call to free

To confirm, assign n to a constant value and try to use the
append_layout command.

Without the change i3 crashes.
This commit is contained in:
Orestis Floros 2017-09-17 00:24:15 +03:00
parent 205dd76096
commit f7a7c7778b
1 changed files with 1 additions and 1 deletions

View File

@ -501,7 +501,7 @@ ssize_t slurp(const char *path, char **buf) {
fclose(f); fclose(f);
if ((ssize_t)n != stbuf.st_size) { if ((ssize_t)n != stbuf.st_size) {
ELOG("File \"%s\" could not be read entirely: got %zd, want %zd\n", path, n, stbuf.st_size); ELOG("File \"%s\" could not be read entirely: got %zd, want %zd\n", path, n, stbuf.st_size);
free(buf); free(*buf);
*buf = NULL; *buf = NULL;
return -1; return -1;
} }