Fix NULL pointer dereference 83/263683/1 accepted/tizen_6.5_unified accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix tizen_6.5 tizen_7.0 tizen_7.0_hotfix accepted/tizen/6.5/unified/20211028.100210 accepted/tizen/7.0/unified/20221110.063237 accepted/tizen/7.0/unified/hotfix/20221116.105152 accepted/tizen/unified/20210917.024330 submit/tizen/20210915.152102 submit/tizen_6.5/20211028.162201 tizen_6.5.m2_release tizen_7.0_m2_release
authorNishant Chaprana <n.chaprana@samsung.com>
Wed, 8 Sep 2021 06:15:23 +0000 (11:45 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Wed, 8 Sep 2021 06:15:25 +0000 (11:45 +0530)
The wrapper function is called in scenarios in which p_trace_route can be NULL.
So NULL check should be performed before deallocation of memory.

Change-Id: I3e985f6890b1f2233a16e08c9cf7e10217b2dd3b
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
src/inm-trace-route.c

index 1667a0cd3f80528bcfca56bfdf68a9b275ebfe3f..d3c4214284919d4f296cd6003f138e6dbcaca703 100644 (file)
@@ -541,6 +541,9 @@ static inline int __create_sock_data()
 
 static inline void __clear_trace_route_data(inm_trace_route_data_s *p_trace_route)
 {
+       if (!p_trace_route)
+               return;
+
        REMOVE_G_SOURCE(p_trace_route->tr_timer_source_id);
        inm_util_destroy_gio_channel(p_trace_route->sock_io_channel, FALSE);
        g_free(p_trace_route->target);