meshctl: Fix meshctl crash 15/222915/1
authorAnurag Biradar <biradar.a@samsung.com>
Fri, 6 Dec 2019 04:13:36 +0000 (09:43 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 20 Jan 2020 05:29:50 +0000 (10:59 +0530)
list entry was not updated properly during flushing of packets

<call stack>
flush_pkt_list (list=0x638b40 <net+64>) at tools/mesh-gatt/net.c:1199
net_session_close (data_in=<optimized out>) at tools/mesh-gatt/net.c:1979
disconnect_device (cb=cb@entry=0x0, user_data=user_data@entry=0x0)
  at tools/meshctl.c:791
cmd_start_prov (argc=<optimized out>, argv=0x6a9fb0)
  at tools/meshctl.c:1789

Change-Id: I5e7827fe7faf8e3611789123373fd5074aabc46b
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
tools/mesh-gatt/net.c

index e8171c6..d74e1f5 100644 (file)
@@ -1197,6 +1197,7 @@ static void flush_pkt_list(GList **list)
                pkt = l->data;
                *list = g_list_remove(*list, pkt);
                g_free(pkt);
+               l = g_list_first(*list);
        }
 }