Fix static analysis issues 41/259841/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 15 Jun 2021 23:36:59 +0000 (08:36 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 15 Jun 2021 23:36:59 +0000 (08:36 +0900)
- Fix logically dead code

Change-Id: Id6fe04a4fb172a9784932dc5328778035c2e55c9
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/event.c

index 06b1f47..c0c174b 100644 (file)
@@ -159,37 +159,27 @@ static bool __get_real_event_name(const char *event_name,
 
 }
 
-static int __set_real_event_info(
-       const char *real_event, const char *event)
+static int __set_real_event_info(const char *real_event, const char *event)
 {
-       char *key = NULL, *value = NULL;
-       int ret = ES_R_OK;
+       char *key;
+       char *value;
 
        if (g_hash_table_lookup(__event_table, real_event) != NULL)
                return ES_R_OK;
 
        key = strdup(real_event);
-       if (key == NULL) {
-               ret = ES_R_ENOMEM;
-               goto out;
-       }
+       if (key == NULL)
+               return ES_R_ENOMEM;
 
        value = strdup(event);
        if (value == NULL) {
-               ret = ES_R_ENOMEM;
-               goto out;
+               free(key);
+               return ES_R_ENOMEM;
        }
 
-out:
-       if (ret == ES_R_OK) {
-               g_hash_table_insert(__event_table, key, value);
-       } else {
-               if (key)
-                       free(key);
-               if (value)
-                       free(value);
-       }
-       return ret;
+       g_hash_table_insert(__event_table, key, value);
+
+       return ES_R_OK;
 }
 
 /* LCOV_EXCL_START */