Fix several memleaks reported by Coverity

NB: Fixes Coverity CID1039268

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-07-08 12:12:48 +01:00
parent 4ea1ea5bf4
commit aea9e86eb4
1 changed files with 9 additions and 2 deletions

View File

@ -975,7 +975,10 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
{
newset = calloc(1, sizeof(Window));
if (!newset)
return;
{
if (old_data) free(old_data);
return;
}
newset[0] = subwin;
num = 1;
@ -986,7 +989,10 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
newset = calloc(num + 1, sizeof(Window));
oldset = (Window *)old_data;
if (!newset)
return;
{
if (old_data) free(old_data);
return;
}
for (i = 0; i < num; ++i)
{
@ -1014,6 +1020,7 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
XA_WINDOW, 32, data, num);
free(newset);
free(old_data);
}
/**