Enlightenment CVS committal
Author : horms
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/canvas
Modified Files:
evas_object_image.c
Log Message:
removed some potential double frees in evas_object_image_*
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/canvas/evas_object_image.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- evas_object_image.c 9 Feb 2003 04:22:45 -0000 1.4
+++ evas_object_image.c 13 Feb 2003 10:25:30 -0000 1.5
@@ -88,6 +88,33 @@
return obj;
}
+#define EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o) \
+ if ((o)->cur.file) \
+ { \
+ free((o)->cur.file); \
+ if ((o)->prev.file == (o)->cur.file) \
+ (o)->prev.file = NULL; \
+ (o)->cur.file = NULL; \
+ } \
+ if ((o)->cur.key) \
+ { \
+ free((o)->cur.key); \
+ if ((o)->prev.key == (o)->cur.key) \
+ (o)->prev.key = NULL; \
+ (o)->cur.key = NULL; \
+ } \
+ if ((o)->prev.file) \
+ { \
+ free((o)->prev.file); \
+ (o)->prev.file = NULL; \
+ } \
+ if ((o)->prev.key) \
+ { \
+ free((o)->prev.key); \
+ (o)->prev.key = NULL; \
+ }
+
+
void
evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
{
@@ -302,10 +329,7 @@
o->engine_data =
obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
o->engine_data,
o->cur.has_alpha);
- if (o->cur.file) {free(o->cur.file); o->cur.file = NULL;}
- if (o->cur.key) {free(o->cur.key); o->cur.key = NULL;}
- if (o->prev.file) {free(o->prev.file); o->prev.file = NULL;}
- if (o->prev.key) {free(o->prev.key); o->prev.key = NULL;}
+ EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
o->changed = 1;
evas_object_change(obj);
}
@@ -370,10 +394,7 @@
o->cur.has_alpha);
if (p_data != o->engine_data)
{
- if (o->cur.file) {free(o->cur.file); o->cur.file = NULL;}
- if (o->cur.key) {free(o->cur.key); o->cur.key = NULL;}
- if (o->prev.file) {free(o->prev.file); o->prev.file = NULL;}
- if (o->prev.key) {free(o->prev.key); o->prev.key = NULL;}
+ EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
}
o->changed = 1;
evas_object_change(obj);
@@ -398,10 +419,7 @@
o->engine_data,
for_writing,
&data);
- if (o->cur.file) {free(o->cur.file); o->cur.file = NULL;}
- if (o->cur.key) {free(o->cur.key); o->cur.key = NULL;}
- if (o->prev.file) {free(o->prev.file); o->prev.file = NULL;}
- if (o->prev.key) {free(o->prev.key); o->prev.key = NULL;}
+ EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
return data;
}
@@ -432,10 +450,7 @@
o->engine_data =
obj->layer->evas->engine.func->image_alpha_set(obj->layer->evas->engine.data.output,
o->engine_data,
o->cur.has_alpha);
- if (o->cur.file) {free(o->cur.file); o->cur.file = NULL;}
- if (o->cur.key) {free(o->cur.key); o->cur.key = NULL;}
- if (o->prev.file) {free(o->prev.file); o->prev.file = NULL;}
- if (o->prev.key) {free(o->prev.key); o->prev.key = NULL;}
+ EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
}
void
@@ -480,10 +495,7 @@
o->engine_data,
o->cur.has_alpha);
evas_object_image_data_update_add(obj, 0, 0, o->cur.image.w, o->cur.image.h);
- if (o->cur.file) {free(o->cur.file); o->cur.file = NULL;}
- if (o->cur.key) {free(o->cur.key); o->cur.key = NULL;}
- if (o->prev.file) {free(o->prev.file); o->prev.file = NULL;}
- if (o->prev.key) {free(o->prev.key); o->prev.key = NULL;}
+ EVAS_OBJECT_IMAGE_FREE_FILE_AND_KEY(o);
}
int
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs