From: Michael Stapelberg Date: Sat, 9 Sep 2017 04:56:50 +0000 (+0200) Subject: i3bar: ensure get_buffer does not leak memory X-Git-Tag: 4.14.1~65 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a542b3d26cb10f2d9f0850dcdec96653301d4c92;p=i3%2Fi3 i3bar: ensure get_buffer does not leak memory This fixes an AddressSanitizer warning which recently popped up. related to #2907 --- diff --git a/i3bar/src/child.c b/i3bar/src/child.c index 814f0411..fe989c44 100644 --- a/i3bar/src/child.c +++ b/i3bar/src/child.c @@ -333,10 +333,12 @@ static unsigned char *get_buffer(ev_io *watcher, int *ret_buffer_len) { break; } ELOG("read() failed!: %s\n", strerror(errno)); + FREE(buffer); exit(EXIT_FAILURE); } if (n == 0) { ELOG("stdin: received EOF\n"); + FREE(buffer); *ret_buffer_len = -1; return NULL; }