From 9c6a21f2d42c14985c7f95d8a42253d98921d794 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ingo=20B=C3=BCrk?= <admin@airblader.de>
Date: Sun, 6 Nov 2016 17:14:37 +0100
Subject: [PATCH] Fix memory leak in i3-msg. (#2542)

relates to #2541
---
 i3-msg/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/i3-msg/main.c b/i3-msg/main.c
index 915d326f..02e156a1 100644
--- a/i3-msg/main.c
+++ b/i3-msg/main.c
@@ -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;