diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-01-04 15:13:51 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-01-04 15:13:51 -0500 |
commit | c37e3b631616313fd93bcbb3da54d68caf95198f (patch) | |
tree | 9cc6929f2338edfb51192620c0f73fc310c1b019 /gdk | |
parent | 8a42bb69aa871c5374532b5b8cd05135daede793 (diff) | |
download | gtk+-c37e3b631616313fd93bcbb3da54d68caf95198f.tar.gz |
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.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/x11/gdkscreen-x11.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 6b098340d6..9f09ce1171 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -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 |