emotion: fix potential memory leak when webcam register fail.

This commit is contained in:
Cedric BAIL 2013-12-13 12:22:06 +09:00
parent f6c4513da4
commit 96c1d15ac0
1 changed files with 7 additions and 2 deletions

View File

@ -226,8 +226,13 @@ _emotion_eeze_events(const char *syspath,
Emotion_Webcam *test;
test = _emotion_webcam_new(syspath);
if ((test) && (_emotion_check_device(test)))
ecore_event_add(EMOTION_WEBCAM_ADD, test, NULL, NULL);
if (test)
{
if (_emotion_check_device(test))
ecore_event_add(EMOTION_WEBCAM_ADD, test, NULL, NULL);
else
_emotion_webcam_remove_cb(test, NULL);
}
}
ecore_event_add(EMOTION_WEBCAM_UPDATE, NULL, NULL, NULL);
}