From: Seungha Son Date: Fri, 12 Jan 2018 02:00:09 +0000 (+0900) Subject: Add null checker X-Git-Tag: submit/tizen/20180112.023807~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f62984c79291dc0583c6000163e3e6ce2e88569e;p=platform%2Fcore%2Fapi%2Fnotification.git Add null checker Signed-off-by: Seungha Son Change-Id: I77c016ccaa3ab08e0e2993b4d5d95fbd46f0bb39 --- diff --git a/src/notification_noti.c b/src/notification_noti.c index 37a4ab43..4fc8deec 100755 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -660,6 +660,10 @@ static int _get_notification_list(char *query_where, notification_list_h *list, if (noti == NULL) { /* LCOV_EXCL_START */ ret = NOTIFICATION_ERROR_OUT_OF_MEMORY; + if (get_list) { + get_list = notification_list_get_head(get_list); + notification_free_list(get_list); + } goto err; /* LCOV_EXCL_STOP */ } @@ -676,6 +680,12 @@ static int _get_notification_list(char *query_where, notification_list_h *list, } } + if (get_list != NULL) { + *list = notification_list_get_head(get_list); + if (list_count) + *list_count = internal_count; + } + err: if (stmt) sqlite3_finalize(stmt); @@ -683,11 +693,6 @@ err: if (db != NULL) notification_db_close(&db); - if (get_list != NULL) { - *list = notification_list_get_head(get_list); - *list_count = internal_count; - } - return ret; } int notification_noti_set_tag(const char *tag, char *value, char *buf, int buf_len)