summaryrefslogtreecommitdiff
path: root/src/lib/emotion/emotion_webcam.c
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-01-11 17:20:22 +0000
committerJérémy Zurcher <jeremy@asynk.ch>2013-01-11 17:20:22 +0000
commit5b885ea931de57a3eaece798d9cbe3ec6aa3cea2 (patch)
tree58ac2485b0ade1db3aab6465c29748055f10c5aa /src/lib/emotion/emotion_webcam.c
parent7d5e6fffb9084220484bfa57aa343c80b4770203 (diff)
fix segv in emotion_webcam_init and leak in emotion_webcam_config_load
SVN revision: 82650
Diffstat (limited to '')
-rw-r--r--src/lib/emotion/emotion_webcam.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/lib/emotion/emotion_webcam.c b/src/lib/emotion/emotion_webcam.c
index d5c75af429..11bd0663f5 100644
--- a/src/lib/emotion/emotion_webcam.c
+++ b/src/lib/emotion/emotion_webcam.c
@@ -215,6 +215,12 @@ Eina_Bool emotion_webcam_init(void)
215 eet_init(); 215 eet_init();
216 _emotion_webcams_edds_new(); 216 _emotion_webcams_edds_new();
217 217
218 if (!_emotion_webcams)
219 {
220 _emotion_webcams = calloc(1, sizeof (Emotion_Webcams));
221 EINA_SAFETY_ON_NULL_RETURN_VAL(_emotion_webcams, EINA_FALSE);
222 }
223
218#ifdef HAVE_EEZE 224#ifdef HAVE_EEZE
219 eeze_init(); 225 eeze_init();
220 226
@@ -256,12 +262,26 @@ emotion_webcam_shutdown(void)
256Eina_Bool 262Eina_Bool
257emotion_webcam_config_load(Eet_File *ef) 263emotion_webcam_config_load(Eet_File *ef)
258{ 264{
265 Emotion_Webcams *emotion_webcams = NULL;
266
259 if (ef) 267 if (ef)
260 { 268 {
261 _emotion_webcams = eet_data_read(ef, _webcams_edd, "config"); 269 emotion_webcams = eet_data_read(ef, _webcams_edd, "config");
262 INF("Loaded config %p from eet %s", _emotion_webcams, eet_file_get(ef)); 270 INF("Loaded config %p from eet %s", _emotion_webcams, eet_file_get(ef));
263 } 271 }
264 272
273 if (emotion_webcams)
274 {
275 if (_emotion_webcams)
276 {
277 emotion_webcam_shutdown();
278 _emotion_webcams = emotion_webcams;
279 emotion_webcam_init();
280 }
281 else
282 _emotion_webcams = emotion_webcams;
283 }
284
265 if (!_emotion_webcams) 285 if (!_emotion_webcams)
266 { 286 {
267 DBG("No config, create empty"); 287 DBG("No config, create empty");