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
1=== modified file 'libutouch-geis/backend/xcb/geis_xcb_backend.c'
2--- libutouch-geis/backend/xcb/geis_xcb_backend.c 2011-08-02 15:21:54 +0000
3+++ libutouch-geis/backend/xcb/geis_xcb_backend.c 2011-08-16 13:50:16 +0000
4@@ -264,10 +264,10 @@
5 }
6
7
8-static int
9+static GeisBoolean
10 _verify_xcb_version(xcb_connection_t *xcb_connection)
11 {
12- int is_valid_version = 0;
13+ GeisBoolean is_valid_version = GEIS_FALSE;
14 xcb_gesture_query_version_cookie_t version_cookie;
15 xcb_gesture_query_version_reply_t *version_reply = NULL;
16 xcb_generic_error_t *error = NULL;
17@@ -292,7 +292,7 @@
18 }
19 else
20 {
21- is_valid_version = 1;
22+ is_valid_version = GEIS_TRUE;
23 }
24
25 free(version_reply);
26@@ -632,17 +632,20 @@
27 if (!be->x11_display)
28 {
29 geis_error("error opening X server.");
30- goto unwind_be;
31+ geis_error_push(geis, GEIS_STATUS_UNKNOWN_ERROR);
32+ goto final_exit;
33 }
34
35 be->xcb_connection = XGetXCBConnection(be->x11_display);
36 if (!be->xcb_connection)
37 {
38 geis_error("error connecting to X server.");
39+ geis_error_push(geis, GEIS_STATUS_UNKNOWN_ERROR);
40 goto unwind_x11;
41 }
42 if (!_verify_xcb_version(be->xcb_connection))
43 {
44+ geis_error_push(geis, GEIS_STATUS_UNKNOWN_ERROR);
45 goto unwind_x11;
46 }
47
48@@ -666,8 +669,6 @@
49 * connection dangling. */
50 if (!be->xcb_connection || !xcb_connection_has_error(be->xcb_connection))
51 XCloseDisplay(be->x11_display);
52-unwind_be:
53- free(be);
54 final_exit:
55 return;
56 }
57
58=== modified file 'libutouch-geis/geis_backend.c'
59--- libutouch-geis/geis_backend.c 2011-06-29 14:40:25 +0000
60+++ libutouch-geis/geis_backend.c 2011-08-16 13:50:16 +0000
61@@ -132,7 +132,13 @@
62 {
63 *(GeisBackendClass *)(backend) = &_be_registry.be[i];
64 _be_registry.be[i].vtbl->construct(_data_from_be(backend), geis);
65+ if (geis_error_count(geis))
66+ {
67+ free(backend);
68+ backend = NULL;
69+ }
70 }
71+ break;
72 }
73 }
74 return backend;
75
76=== modified file 'libutouch-geis/geis_gesture_flick.c'
77--- libutouch-geis/geis_gesture_flick.c 2011-07-01 13:02:58 +0000
78+++ libutouch-geis/geis_gesture_flick.c 2011-08-16 13:50:16 +0000
79@@ -243,7 +243,10 @@
80 void
81 geis_gesture_flick_delete(GeisGestureFlick flick)
82 {
83- geis_gesture_class_unref(flick->flick_class);
84- free(flick);
85+ if (flick)
86+ {
87+ geis_gesture_class_unref(flick->flick_class);
88+ free(flick);
89+ }
90 }
91

Subscribers

People subscribed via source and target branches