From 98a23a611205745f7bcf81b2fcbb8e03121c2ce0 Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Sun, 23 Dec 2012 09:07:12 +0000 Subject: [PATCH] Fix segmentation fault if no bitmap was present in the snapshot file Signed-off-by: Daniel Zaoui SVN revision: 81653 --- src/lib/clouseau_data.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/lib/clouseau_data.c b/src/lib/clouseau_data.c index 8ee34a3..d729035 100644 --- a/src/lib/clouseau_data.c +++ b/src/lib/clouseau_data.c @@ -884,25 +884,28 @@ clouseau_data_eet_info_read(const char *filename, *ftd = eet_data_read(fp, clouseau_tree_data_edd, CLOUSEAU_TREE_DATA_ENTRY); t = eet_data_read(fp, clouseau_shot_list_edd, CLOUSEAU_BMP_LIST_ENTRY); - EINA_LIST_FREE(t->view, st) + if (t) { - char buf[1024]; - int alpha; - int compress; - int quality; - int lossy; + EINA_LIST_FREE(t->view, st) + { + char buf[1024]; + int alpha; + int compress; + int quality; + int lossy; - sprintf(buf, CLOUSEAU_BMP_DATA_ENTRY"/%llx", st->object); - st->bmp = eet_data_image_read(fp, buf, - (unsigned int *) &st->w, - (unsigned int *) &st->h, - &alpha, &compress, &quality, &lossy); + sprintf(buf, CLOUSEAU_BMP_DATA_ENTRY"/%llx", st->object); + st->bmp = eet_data_image_read(fp, buf, + (unsigned int *) &st->w, + (unsigned int *) &st->h, + &alpha, &compress, &quality, &lossy); - /* Add the bitmaps to the actuall app data struct */ - (*a)->view = eina_list_append((*a)->view, st); + /* Add the bitmaps to the actuall app data struct */ + (*a)->view = eina_list_append((*a)->view, st); + } + + free(t); } - - free(t); eet_close(fp); return EINA_TRUE;