Fix NULL dreference 58/242658/3
authorPrasadam Prashath Kumar <prasadam.p@samsung.com>
Fri, 28 Aug 2020 12:22:48 +0000 (17:52 +0530)
committerPrasadam Prashath Kumar <prasadam.p@samsung.com>
Fri, 28 Aug 2020 12:43:07 +0000 (18:13 +0530)
checked the NULL before dereference

Change-Id: Ic5ea6e726b700ede91b1306d8d93f3a2ef4e4fd3
Signed-off-by: Prasadam Prashath Kumar <prasadam.p@samsung.com>
src/mobileap_softap.c

index 4418dfd..db87dba 100755 (executable)
@@ -660,6 +660,12 @@ static gboolean __hostapd_monitor_cb(GIOChannel *source, GIOCondition condition,
                        sta_timer_list = g_slist_append(sta_timer_list, ptr);
                        band_update_info_t *info = NULL;
                        info = (band_update_info_t *)g_malloc(sizeof(band_update_info_t));
+                       if (info == NULL) {
+                               ERR("g_malloc failed\n");
+                               g_free(mac);
+                               mac = NULL;
+                               return TRUE;
+                       }
                        info->mac_addr = g_strdup(mac);
                        info->band = (hostapd_monitor_fd[HOSTAPD_WIFI_BAND_2G] == *data_fd) ? HOSTAPD_WIFI_BAND_2G : HOSTAPD_WIFI_BAND_5G;
                        _add_mac_band_info(info);