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:
parent
b48cbe42af
commit
a542b3d26c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue