Merge lp:~bregma/geis/lp-825359 into lp:geis

Proposed by Stephen M. Webb
Status: Merged
Merged at revision: 157
Proposed branch: lp:~bregma/geis/lp-825359
Merge into: lp:geis
Diff against target: 90 lines (+18/-8)
3 files modified
libutouch-geis/backend/xcb/geis_xcb_backend.c (+7/-6)
libutouch-geis/geis_backend.c (+6/-0)
libutouch-geis/geis_gesture_flick.c (+5/-2)
To merge this branch: bzr merge lp:~bregma/geis/lp-825359
Reviewer Review Type Date Requested Status
Chase Douglas (community) Approve
Jussi Pakkanen (community) Approve
Review via email: mp+71691@code.launchpad.net

Description of the change

Fix prevents the improper deallocation of resources on failure to establish a connection with the X server in the XCB back end.

Fixes bug lp:825359.

To post a comment you must log in.
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Looks ok.

review: Approve
Revision history for this message
Chase Douglas (chasedouglas) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libutouch-geis/backend/xcb/geis_xcb_backend.c'
--- libutouch-geis/backend/xcb/geis_xcb_backend.c 2011-08-02 15:21:54 +0000
+++ libutouch-geis/backend/xcb/geis_xcb_backend.c 2011-08-16 13:50:16 +0000
@@ -264,10 +264,10 @@
264}264}
265265
266266
267static int267static GeisBoolean
268_verify_xcb_version(xcb_connection_t *xcb_connection)268_verify_xcb_version(xcb_connection_t *xcb_connection)
269{269{
270 int is_valid_version = 0;270 GeisBoolean is_valid_version = GEIS_FALSE;
271 xcb_gesture_query_version_cookie_t version_cookie;271 xcb_gesture_query_version_cookie_t version_cookie;
272 xcb_gesture_query_version_reply_t *version_reply = NULL;272 xcb_gesture_query_version_reply_t *version_reply = NULL;
273 xcb_generic_error_t *error = NULL;273 xcb_generic_error_t *error = NULL;
@@ -292,7 +292,7 @@
292 }292 }
293 else293 else
294 {294 {
295 is_valid_version = 1;295 is_valid_version = GEIS_TRUE;
296 }296 }
297297
298 free(version_reply);298 free(version_reply);
@@ -632,17 +632,20 @@
632 if (!be->x11_display)632 if (!be->x11_display)
633 {633 {
634 geis_error("error opening X server.");634 geis_error("error opening X server.");
635 goto unwind_be;635 geis_error_push(geis, GEIS_STATUS_UNKNOWN_ERROR);
636 goto final_exit;
636 }637 }
637638
638 be->xcb_connection = XGetXCBConnection(be->x11_display);639 be->xcb_connection = XGetXCBConnection(be->x11_display);
639 if (!be->xcb_connection)640 if (!be->xcb_connection)
640 {641 {
641 geis_error("error connecting to X server.");642 geis_error("error connecting to X server.");
643 geis_error_push(geis, GEIS_STATUS_UNKNOWN_ERROR);
642 goto unwind_x11;644 goto unwind_x11;
643 }645 }
644 if (!_verify_xcb_version(be->xcb_connection))646 if (!_verify_xcb_version(be->xcb_connection))
645 {647 {
648 geis_error_push(geis, GEIS_STATUS_UNKNOWN_ERROR);
646 goto unwind_x11;649 goto unwind_x11;
647 }650 }
648651
@@ -666,8 +669,6 @@
666 * connection dangling. */669 * connection dangling. */
667 if (!be->xcb_connection || !xcb_connection_has_error(be->xcb_connection))670 if (!be->xcb_connection || !xcb_connection_has_error(be->xcb_connection))
668 XCloseDisplay(be->x11_display);671 XCloseDisplay(be->x11_display);
669unwind_be:
670 free(be);
671final_exit:672final_exit:
672 return;673 return;
673}674}
674675
=== modified file 'libutouch-geis/geis_backend.c'
--- libutouch-geis/geis_backend.c 2011-06-29 14:40:25 +0000
+++ libutouch-geis/geis_backend.c 2011-08-16 13:50:16 +0000
@@ -132,7 +132,13 @@
132 {132 {
133 *(GeisBackendClass *)(backend) = &_be_registry.be[i];133 *(GeisBackendClass *)(backend) = &_be_registry.be[i];
134 _be_registry.be[i].vtbl->construct(_data_from_be(backend), geis);134 _be_registry.be[i].vtbl->construct(_data_from_be(backend), geis);
135 if (geis_error_count(geis))
136 {
137 free(backend);
138 backend = NULL;
139 }
135 }140 }
141 break;
136 }142 }
137 }143 }
138 return backend;144 return backend;
139145
=== modified file 'libutouch-geis/geis_gesture_flick.c'
--- libutouch-geis/geis_gesture_flick.c 2011-07-01 13:02:58 +0000
+++ libutouch-geis/geis_gesture_flick.c 2011-08-16 13:50:16 +0000
@@ -243,7 +243,10 @@
243void243void
244geis_gesture_flick_delete(GeisGestureFlick flick)244geis_gesture_flick_delete(GeisGestureFlick flick)
245{245{
246 geis_gesture_class_unref(flick->flick_class);246 if (flick)
247 free(flick);247 {
248 geis_gesture_class_unref(flick->flick_class);
249 free(flick);
250 }
248}251}
249252

Subscribers

People subscribed via source and target branches