Comment 9 for bug 1260290

Revision history for this message
Nirbhay Choubey (nirbhay) wrote :

Freeing w->ctx before options can lead to segfault.

nirbhay@nirbhay-VirtualBox:~/project/repo/codership/5.5$ bzr diff
=== modified file 'wsrep/wsrep_dummy.c'
--- wsrep/wsrep_dummy.c 2014-05-04 07:12:59 +0000
+++ wsrep/wsrep_dummy.c 2014-06-11 20:44:29 +0000
@@ -44,11 +44,11 @@
 static void dummy_free(wsrep_t *w)
 {
     WSREP_DBUG_ENTER(w);
+ if (WSREP_DUMMY(w)->options) {
+ free(WSREP_DUMMY(w)->options);
+ WSREP_DUMMY(w)->options = NULL;
+ }
     free(w->ctx);
- if (WSREP_DUMMY(w)->options) {
- free(WSREP_DUMMY(w)->options);
- WSREP_DUMMY(w)->options = NULL;
- }
     w->ctx = NULL;
 }