ecore_x: always free data and return value

if we are the selected parser, we are responsible for free'ing data and
returning a selection value.
This commit is contained in:
Sebastian Dransfeld 2013-12-07 17:46:29 +01:00
parent f22f861f61
commit aca33ef3d9
1 changed files with 3 additions and 10 deletions

View File

@ -783,21 +783,13 @@ _ecore_x_selection_parser_files(const char *target,
/* Isn't nul terminated */
size++;
t = realloc(data, size);
if (!t)
{
free(sel);
return NULL;
}
if (!t) goto done;
data = t;
data[size - 1] = 0;
}
tmp = malloc(size);
if (!tmp)
{
free(sel);
return NULL;
}
if (!tmp) goto done;
i = 0;
is = 0;
while ((is < size) && (data[is]))
@ -840,6 +832,7 @@ _ecore_x_selection_parser_files(const char *target,
free(tmp);
}
done:
free(data);
ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES;