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;
/* get any outputs on this crtc */
outputs =
ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs);
/* if this crtc has no outputs, we can use it */
if ((!outputs) || (noutputs == 0))
if (!(outputs =
ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs)))
ret = crtcs[i];
else if (noutputs == 0)
ret = crtcs[i];
else
{
@ -2421,6 +2420,7 @@ _e_smart_monitor_crtc_find(Ecore_X_Randr_Output output)
}
}
free(outputs);
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();
modes = ecore_x_randr_output_modes_get(root, output, &n, &p);
if ((!modes) || (n == 0)) return;
if (!(modes = ecore_x_randr_output_modes_get(root, output, &n, &p)))
return;
if (n == 0)
{
if (modes) free(modes);
return;
}
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;
/* get any outputs on this crtc */
outputs =
ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs);
/* if this crtc has no outputs, we can use it */
if ((!outputs) || (noutputs == 0))
if (!(outputs =
ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs)))
ret = crtcs[i];
else if (noutputs == 0)
ret = crtcs[i];
else
{
@ -906,6 +911,7 @@ _e_smart_randr_crtc_find(Ecore_X_Randr_Output output)
}
}
free(outputs);
if (ret) break;
}