fix svace issue 03/115703/1 accepted/tizen/common/20170221.135159 accepted/tizen/ivi/20170221.225505 accepted/tizen/mobile/20170221.225432 accepted/tizen/unified/20170309.031519 accepted/tizen/wearable/20170221.225446 submit/tizen/20170221.063156 submit/tizen_unified/20170308.100404
authorJooseok Song <seogii.song@samsung.com>
Tue, 21 Feb 2017 05:48:14 +0000 (14:48 +0900)
committerJooseok Song <seogii.song@samsung.com>
Tue, 21 Feb 2017 05:48:14 +0000 (14:48 +0900)
Change-Id: Ib969212bed1c64f391834caf5b256ff829ff1cc4

packaging/account-manager.spec
server/src/account-server-db.c

index 628dead..5d67b0e 100644 (file)
@@ -1,6 +1,6 @@
 Name:       account-manager
 Summary:    Account Manager
-Version:    0.1.13
+Version:    0.1.14
 Release:    1
 Group:      Social & Content/Other
 License:    Apache-2.0
index a288777..2510ba4 100644 (file)
@@ -1184,7 +1184,13 @@ GSList* _account_get_capability_list_by_account_id(int account_id, int *error_co
        }
 
        rc = _account_query_finalize(hstmt);
-       ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, NULL, ("finalize error"));
+       if (rc != _ACCOUNT_ERROR_NONE) {
+               _ERR("finalize error");
+               _account_gslist_capability_free(capability_list);
+               *error_code = rc;
+               return NULL;
+       }
+
        hstmt = NULL;
 
        *error_code = _ACCOUNT_ERROR_NONE;
@@ -1748,7 +1754,7 @@ GSList* _account_db_query_all(int pid, uid_t uid)
        }
 
        rc = _account_query_finalize(hstmt);
-       ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, NULL, ("finalize error"));
+       ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {_account_gslist_account_free(account_list); }, NULL, ("finalize error"));
        hstmt = NULL;
 
        GSList* iter;
@@ -3456,7 +3462,7 @@ GSList* _account_type_get_label_list_by_app_id_from_global_db(const char* app_id
        GSList* label_list = NULL;
 
        ACCOUNT_RETURN_VAL((app_id != NULL), { *error_code = _ACCOUNT_ERROR_INVALID_PARAMETER; }, NULL, ("APP ID IS NULL"));
-       ACCOUNT_RETURN_VAL((g_hAccountGlobalDB != NULL), { *error_code = _ACCOUNT_ERROR_DB_NOT_OPENED; }, NULL, ("The database isn't connected."));
+       ACCOUNT_RETURN_VAL((g_hAccountGlobalDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
 
        ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
 
@@ -3558,7 +3564,12 @@ GSList* _account_type_get_label_list_by_app_id(const char* app_id, int *error_co
        }
 
        rc = _account_query_finalize(hstmt);
-       ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, NULL, ("finalize error"));
+       if (rc != _ACCOUNT_ERROR_NONE) {
+                       _account_type_gslist_label_free(label_list);
+                       *error_code = rc;
+                       _ERR("finalize error");
+                       return NULL;
+               }
        hstmt = NULL;
 
        *error_code = _ACCOUNT_ERROR_NONE;
@@ -3566,7 +3577,12 @@ GSList* _account_type_get_label_list_by_app_id(const char* app_id, int *error_co
 CATCH:
        if (hstmt != NULL) {
                rc = _account_query_finalize(hstmt);
-               ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), { *error_code = rc; }, NULL, ("finalize error"));
+               if (rc != _ACCOUNT_ERROR_NONE) {
+                       _account_type_gslist_label_free(label_list);
+                       *error_code = rc;
+                       _ERR("finalize error");
+                       return NULL;
+               }
                hstmt = NULL;
        }
 
@@ -4115,7 +4131,7 @@ int _account_type_query_all_from_global_db(GSList **account_type_list_all)
        GSList *account_type_list = NULL;
 
        _INFO("_account_type_query_all_in_global_db start");
-       ACCOUNT_RETURN_VAL((g_hAccountGlobalDB != NULL), {}, _ACCOUNT_ERROR_DB_NOT_OPENED, ("The database isn't connected."));
+       ACCOUNT_RETURN_VAL((g_hAccountGlobalDB != NULL), {}, NULL, ("The database isn't connected."));
 
        ACCOUNT_MEMSET(query, 0x00, ACCOUNT_SQL_LEN_MAX);
 
@@ -4152,7 +4168,7 @@ int _account_type_query_all_from_global_db(GSList **account_type_list_all)
        }
 
        rc = _account_query_finalize(hstmt);
-       ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, rc, ("finalize error"));
+       ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {_account_type_gslist_account_type_free(account_type_list); }, rc, ("finalize error"));
        hstmt = NULL;
 
        GSList* iter;
@@ -4231,7 +4247,7 @@ GSList* _account_type_query_all(void)
        }
 
        rc = _account_query_finalize(hstmt);
-       ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {}, NULL, ("finalize error"));
+       ACCOUNT_RETURN_VAL((rc == _ACCOUNT_ERROR_NONE), {_account_type_gslist_account_type_free(account_type_list); }, NULL, ("finalize error"));
        hstmt = NULL;
 
        GSList* iter;