]> git.sur5r.net Git - i3/i3/commitdiff
Fix memory leak in i3-msg. (#2542)
authorIngo Bürk <admin@airblader.de>
Sun, 6 Nov 2016 16:14:37 +0000 (17:14 +0100)
committerMichael Stapelberg <stapelberg@users.noreply.github.com>
Sun, 6 Nov 2016 16:14:37 +0000 (08:14 -0800)
relates to #2541

i3-msg/main.c

index 915d326f52052d70dfefe4302b0ca6003bd87e82..02e156a16764952f6308403316e60c353ce35322 100644 (file)
@@ -240,9 +240,10 @@ int main(int argc, char *argv[]) {
     /* For the reply of commands, have a look if that command was successful.
      * If not, nicely format the error message. */
     if (reply_type == I3_IPC_MESSAGE_TYPE_COMMAND) {
-        yajl_handle handle;
-        handle = yajl_alloc(&reply_callbacks, NULL, NULL);
+        yajl_handle handle = yajl_alloc(&reply_callbacks, NULL, NULL);
         yajl_status state = yajl_parse(handle, (const unsigned char *)reply, reply_length);
+        yajl_free(handle);
+
         switch (state) {
             case yajl_status_ok:
                 break;