Fix potential memleaks reported by klockwork.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-05-20 10:27:16 +01:00
parent dff4df51f3
commit 10acf59475
2 changed files with 18 additions and 12 deletions

View File

@ -2401,11 +2401,10 @@ _e_smart_monitor_crtc_find(Ecore_X_Randr_Output output)
int j = 0; int j = 0;
/* get any outputs on this crtc */ /* get any outputs on this crtc */
outputs = if (!(outputs =
ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs); ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs)))
ret = crtcs[i];
/* if this crtc has no outputs, we can use it */ else if (noutputs == 0)
if ((!outputs) || (noutputs == 0))
ret = crtcs[i]; ret = crtcs[i];
else else
{ {
@ -2421,6 +2420,7 @@ _e_smart_monitor_crtc_find(Ecore_X_Randr_Output output)
} }
} }
free(outputs);
if (ret) break; if (ret) break;
} }

View File

@ -806,8 +806,14 @@ _e_smart_randr_monitor_preferred_mode_size_get(Ecore_X_Randr_Output output, Evas
root = ecore_x_window_root_first_get(); root = ecore_x_window_root_first_get();
modes = ecore_x_randr_output_modes_get(root, output, &n, &p); if (!(modes = ecore_x_randr_output_modes_get(root, output, &n, &p)))
if ((!modes) || (n == 0)) return; return;
if (n == 0)
{
if (modes) free(modes);
return;
}
ecore_x_randr_mode_size_get(root, modes[p - 1], mw, mh); ecore_x_randr_mode_size_get(root, modes[p - 1], mw, mh);
@ -886,11 +892,10 @@ _e_smart_randr_crtc_find(Ecore_X_Randr_Output output)
int j = 0; int j = 0;
/* get any outputs on this crtc */ /* get any outputs on this crtc */
outputs = if (!(outputs =
ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs); ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs)))
ret = crtcs[i];
/* if this crtc has no outputs, we can use it */ else if (noutputs == 0)
if ((!outputs) || (noutputs == 0))
ret = crtcs[i]; ret = crtcs[i];
else else
{ {
@ -906,6 +911,7 @@ _e_smart_randr_crtc_find(Ecore_X_Randr_Output output)
} }
} }
free(outputs);
if (ret) break; if (ret) break;
} }