static bm_display_st *_variant_to_bds(GVariant *param)
{
+ bm_display_st *bds_header = NULL;
bm_display_st *bds = NULL;
+ GSList *bds_list = NULL;
app_time_map_st1 *atm = NULL;
GVariantIter *iter = NULL;
GVariantIter *sub_iter = NULL;
atm = (app_time_map_st1 *)malloc(sizeof(app_time_map_st1));
if (!atm) {
_E("failed to allocate memory");
- goto err_atm;
+ goto err;
}
atm->app_id = g_strdup(app_id);
bds = (bm_display_st *)malloc(sizeof(bm_display_st));
if (!bds) {
_E("failed to allocate memory");
- goto err_atm;
+ g_slist_free_full(atm_list, _atm_list_free);
+ goto err;
}
bds->high = vals[0];
bds->med = vals[2];
bds->start = t_start;
bds->stop = t_end;
- bds->atm_list = atm_list;
+ bds->atm_list = g_slist_reverse(atm_list);
bds->display_list = NULL;
- //bds->display_list = g_slist_prepend(bds->display_list, bds);
+
+ bds_list = g_slist_prepend(bds_list, bds);
+ }
+
+ bds_header = (bm_display_st *)calloc(1, sizeof(bm_display_st));
+ if (!bds_header) {
+ _E("failed to allocate memory");
+ goto err;
}
+ bds_header->display_list = g_slist_reverse(bds_list);
+
g_variant_iter_free(iter);
EXIT;
- return bds;
+ return bds_header;
-err_atm:
- if (atm_list)
- g_slist_free_full(atm_list, _atm_list_free);
err:
if (iter)
g_variant_iter_free(iter);
- if (bds && bds->display_list)
- g_slist_free_full(bds->display_list, _bds_list_free);
+ if (bds_list)
+ g_slist_free_full(bds_list, _bds_list_free);
EXIT;
return NULL;