Free array and builder before exiting the function
when it is failed by error.
Change-Id: I28894c74e8a4606498ea5b789de7345f9d155a54
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
}
if (heart_battery_get_capacity_history_latest(arrays, charge, max_size) != RESOURCED_ERROR_NONE) {
_E("Failed to get capacity history latest");
- D_BUS_REPLY_ERR(invocation);
- return;
+ g_array_free(arrays, TRUE);
+ goto failure;
}
g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE);
if (ret) {
_E("pthread_mutex_unlock() failed, %d", ret);
g_variant_builder_unref(sub_builder);
+ g_variant_builder_clear(&builder);
goto failure;
}