mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
x11: Avoid a possible memory leak in an error case
If _NET_WORKAREA is set to nonsensical values, we should still free the memory before returning.
This commit is contained in:
parent
8a42bb69aa
commit
c37e3b6316
@ -314,7 +314,7 @@ get_work_area (GdkScreen *screen,
|
||||
gulong num;
|
||||
gulong leftovers;
|
||||
gulong max_len = 4 * 32;
|
||||
guchar *ret_workarea;
|
||||
guchar *ret_workarea = NULL;
|
||||
long *workareas;
|
||||
int result;
|
||||
int disp_screen;
|
||||
@ -356,7 +356,7 @@ get_work_area (GdkScreen *screen,
|
||||
format == 0 ||
|
||||
leftovers ||
|
||||
num % 4 != 0)
|
||||
return;
|
||||
goto out;
|
||||
|
||||
desktop = get_current_desktop (screen);
|
||||
|
||||
@ -371,7 +371,9 @@ get_work_area (GdkScreen *screen,
|
||||
area->width /= x11_screen->window_scale;
|
||||
area->height /= x11_screen->window_scale;
|
||||
|
||||
XFree (ret_workarea);
|
||||
out:
|
||||
if (ret_workarea)
|
||||
XFree (ret_workarea);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user