Change-Id: I2a70043afafb76f1594313899a16f01679e82586
Signed-off-by: Semun Lee <semun.lee@samsung.com>
GIOCondition condition,
gpointer user_data);
GIOCondition condition,
gpointer user_data);
+static void __free_system(stc_system_s *system)
+{
+ /* destroy monitored application tree */
+ if (system->apps)
+ g_hash_table_destroy(system->apps);
+ /* destroy restriction rules tree */
+ if (system->rstns)
+ g_hash_table_destroy(system->rstns);
+ FREE(system);
+}
+
static stc_error_e __close_and_reopen_contr_sock(stc_system_s *system)
{
GIOChannel *gio = NULL;
static stc_error_e __close_and_reopen_contr_sock(stc_system_s *system)
{
GIOChannel *gio = NULL;
system->contr_sock = create_netlink(NETLINK_NETFILTER, 0);
if (system->contr_sock < 0) {
STC_LOGE("failed to open socket");
system->contr_sock = create_netlink(NETLINK_NETFILTER, 0);
if (system->contr_sock < 0) {
STC_LOGE("failed to open socket");
+ __free_system(system);
+ g_system = NULL;
system->contr_sock = create_netlink(NETLINK_NETFILTER, 0);
if (system->contr_sock < 0) {
STC_LOGE("failed to open socket");
system->contr_sock = create_netlink(NETLINK_NETFILTER, 0);
if (system->contr_sock < 0) {
STC_LOGE("failed to open socket");
g_system->contr_timer_id = 0;
}
g_system->contr_timer_id = 0;
}
- /* destroy monitored application tree */
- g_hash_table_destroy(g_system->apps);
- g_system->apps = NULL;
-
- /* destroy restriction rules tree */
- g_hash_table_destroy(g_system->rstns);
- g_system->rstns = NULL;
-
- FREE(g_system);
+ __free_system(g_system);
+ g_system = NULL;