meshctl: Fix possible use_after_free
authorGopal Tiwari <gtiwari@redhat.com>
Tue, 31 May 2022 07:41:16 +0000 (13:11 +0530)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:54 +0000 (14:55 +0530)
Reported by coverity tool as follows :

bluez-5.64/tools/meshctl.c:1968: freed_arg: "g_free" frees "mesh_dir".

bluez-5.64/tools/meshctl.c:2018: double_free: Calling "g_free" frees
pointer "mesh_dir" which has already been freed.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/meshctl.c

index cc788a0..4dcc1ad 100644 (file)
@@ -2014,7 +2014,6 @@ int main(int argc, char *argv[])
 
 fail:
        bt_shell_cleanup();
-       g_free(mesh_dir);
 
        return EXIT_FAILURE;
 }