i3bar: ensure get_buffer does not leak memory

This fixes an AddressSanitizer warning which recently popped up.

related to #2907
This commit is contained in:
Michael Stapelberg 2017-09-09 06:56:50 +02:00
parent b48cbe42af
commit a542b3d26c
1 changed files with 2 additions and 0 deletions

View File

@ -333,10 +333,12 @@ static unsigned char *get_buffer(ev_io *watcher, int *ret_buffer_len) {
break; break;
} }
ELOG("read() failed!: %s\n", strerror(errno)); ELOG("read() failed!: %s\n", strerror(errno));
FREE(buffer);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (n == 0) { if (n == 0) {
ELOG("stdin: received EOF\n"); ELOG("stdin: received EOF\n");
FREE(buffer);
*ret_buffer_len = -1; *ret_buffer_len = -1;
return NULL; return NULL;
} }