daemon: fix USE_AFTER_FREE issue 68/49268/2
authorSuchang Woo <suchang.woo@samsung.com>
Mon, 12 Oct 2015 07:59:56 +0000 (16:59 +0900)
committerSuchang Woo <suchang.woo@samsung.com>
Mon, 12 Oct 2015 08:02:28 +0000 (17:02 +0900)
Change-Id: I0ac80b247c38ced376a0fbf37d132247ef97bd9b
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
daemon/daemon.c

index 416cf90..b8df6a1 100644 (file)
@@ -425,10 +425,8 @@ static void proc_unnotify(struct bxt_client *cli,
        }
 
        noti = g_hash_table_lookup(cli->bxtd->notis, lykey);
-
-       free(lykey);
-
        if (!noti) {
+               free(lykey);
                resp->res = ENOENT;
                return;
        }
@@ -442,6 +440,8 @@ static void proc_unnotify(struct bxt_client *cli,
                g_hash_table_remove(cli->bxtd->notis, lykey);
 
        resp->res = 0;
+
+       free(lykey);
 }
 
 static void proc_set_priv(struct bxt_client *cli,