Fix potential memleak reported by klockwork.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-05-29 13:24:49 +01:00
parent 23fc3b3da7
commit 964f4769ae
1 changed files with 5 additions and 1 deletions

View File

@ -620,7 +620,11 @@ _ecore_wl_dnd_selection_data_read(void *data, Ecore_Fd_Handler *fd_handler EINA_
else
{
event->data = malloc(len + 1);
if (!event->data) return ECORE_CALLBACK_CANCEL;
if (!event->data)
{
free(event);
return ECORE_CALLBACK_CANCEL;
}
strncpy(event->data, buffer, len);
event->data[len] = '\0';
event->len = len;