]> git.sur5r.net Git - i3/i3/commitdiff
i3bar: ensure get_buffer does not leak memory
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 9 Sep 2017 04:56:50 +0000 (06:56 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 9 Sep 2017 04:56:50 +0000 (06:56 +0200)
This fixes an AddressSanitizer warning which recently popped up.

related to #2907

i3bar/src/child.c

index 814f041110d48db57c296a6cc0a47d59ce98954d..fe989c44c25a639c8f51e6f8589d2fa787db8abd 100644 (file)
@@ -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;
         }