gpointer user_data)
{
int sock = g_io_channel_unix_get_fd(source);
- struct genl ans;
+ struct genl *ans;
int ret;
stc_s *stc = stc_get_manager();
- if ((condition & G_IO_ERR) ||
- (condition & G_IO_HUP) ||
+ if ((condition & G_IO_ERR) || (condition & G_IO_HUP) ||
(condition & G_IO_NVAL)) {
/* G_IO_ERR/G_IO_HUP/G_IO_NVAL received */
return FALSE;
}
+ ans = MALLOC0(struct genl, 1);
+ if (ans == NULL) {
+ STC_LOGE("Failed allocate memory to genl reply message");
+ return TRUE;
+ }
+
if (stc == NULL) {
STC_LOGE("Can't get stc data");
goto out;
}
- ret = read_netlink(sock,
- &ans, sizeof(struct genl));
+ ret = read_netlink(sock, ans, sizeof(struct genl));
/* STC_LOGD("Counter data received ret [%d]", ret); */
if (ret == 0)
goto out;
stc->carg->ans_len = ret;
- __process_network_counter(&ans, stc->carg);
+ __process_network_counter(ans, stc->carg);
g_idle_add(__flush_apps_stats_to_database, NULL);
g_idle_add(__flush_rstns_counter_to_database, NULL);
out:
+ FREE(ans);
return TRUE;
}