ticker: Memory leak fix.
authorRadoslaw Czerski <r.czerski@samsung.com>
Fri, 1 Apr 2016 15:13:10 +0000 (17:13 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Mon, 4 Apr 2016 10:02:43 +0000 (03:02 -0700)
Change-Id: I2e81209ba280b0861213f4821627aafad37df4af
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
src/ticker.c

index ef07c5539fdf362caa80e88a5d560e59a6195303..7d0bc838c95075270f20da2080603c9a050ee514 100644 (file)
@@ -1014,9 +1014,6 @@ static void _ticker_noti_detailed_changed_cb(void *data, notification_type_e typ
 
        _D("_ticker_noti_changed_cb");
 
-       ticker_info = calloc(1, sizeof(ticker_info_s));
-       ret_if(!ticker_info);
-
        if (num_op == 1) {
                //TODO: Functions below are depracated, should not be used
                ret = notification_op_get_data(op_list, NOTIFICATION_OP_DATA_TYPE, &op_type);
@@ -1074,6 +1071,9 @@ static void _ticker_noti_detailed_changed_cb(void *data, notification_type_e typ
                return;
        }
 
+       ticker_info = calloc(1, sizeof(ticker_info_s));
+       ret_if(ticker_info == NULL);
+
        /* Skip if previous ticker is still shown */
 /*
        if (ticker_info->win != NULL) {
@@ -1105,6 +1105,7 @@ static void _ticker_noti_detailed_changed_cb(void *data, notification_type_e typ
                        return;
                }
        }
+       free(ticker_info);
 }
 
 static Eina_Bool _tickernoti_callback_register_idler_cb(void *data)