Fix issue detected by static analysis tool 28/258628/1
authorInHong Han <inhong1.han@samsung.com>
Fri, 21 May 2021 08:20:41 +0000 (17:20 +0900)
committerInHong Han <inhong1.han@samsung.com>
Fri, 21 May 2021 08:20:44 +0000 (17:20 +0900)
double_free: Calling g_variant_iter_free frees pointer info_iter which has already been freed.
pass_freed_arg: Passing freed pointer keyword_iter as an argument to g_variant_iter_free.

Change-Id: I9517519228317fbf921f5bef60641146c20ff72d

client/src/sticker_dbus.c

index 75c1a89..a36cfaa 100644 (file)
@@ -179,13 +179,6 @@ static void _handle_sticker_consumer_cb(GDBusConnection *connection,
                 g_variant_get(parameters, "(ia{iv}a(s))", &event_type, &info_iter, &keyword_iter);
                 _get_sticker_info_from_gvariant(info_iter, keyword_iter, sticker_data);
                 consumer_handle->event_cb((sticker_consumer_event_type_e)event_type, sticker_data, consumer_handle->event_cb_user_data);
-
-                if (info_iter)
-                    g_variant_iter_free(info_iter);
-
-                if (keyword_iter)
-                    g_variant_iter_free(keyword_iter);
-
                 sticker_data_destroy(sticker_data);
             }
         }
@@ -619,12 +612,6 @@ int sticker_dbus_update_sticker_info(GDBusConnection *gdbus_connection, sticker_
 
         g_variant_get(reply_body, "(a{iv}a(s))", &info_iter, &keyword_iter);
         _get_sticker_info_from_gvariant(info_iter, keyword_iter, origin_data);
-
-        if (info_iter)
-            g_variant_iter_free(info_iter);
-
-        if (keyword_iter)
-            g_variant_iter_free(keyword_iter);
     } else {
         LOGW("failed to get sticker info");
         free(origin_data);
@@ -781,12 +768,6 @@ int sticker_dbus_get_sticker_info_by_record_id(GDBusConnection *gdbus_connection
 
         if (reply_body)
             g_variant_unref(reply_body);
-
-        if (info_iter)
-            g_variant_iter_free(info_iter);
-
-        if (keyword_iter)
-            g_variant_iter_free(keyword_iter);
     }
 
     if (reply)
@@ -1132,12 +1113,6 @@ int sticker_dbus_get_sticker_info_by_uri(GDBusConnection *gdbus_connection, stic
 
         if (reply_body)
             g_variant_unref(reply_body);
-
-        if (info_iter)
-            g_variant_iter_free(info_iter);
-
-        if (keyword_iter)
-            g_variant_iter_free(keyword_iter);
     }
 
     if (reply)