[pkg-fso-commits] [SCM] Automatic Display Manager branch, bug540201, updated. debian/0.6-1-41-ga92acb4

Enrico Zini enrico at enricozini.org
Wed Jul 6 09:32:54 UTC 2011


The following commit has been merged in the bug540201 branch:
commit a92acb44c4ee3b817d6859f3ee61725194a975d2
Author: Enrico Zini <enrico at enricozini.org>
Date:   Wed Jul 6 11:32:51 2011 +0200

    Fixed two small memory leaks

diff --git a/dm.c b/dm.c
index 6318e1a..54e6a36 100644
--- a/dm.c
+++ b/dm.c
@@ -34,6 +34,7 @@ void nodm_display_manager_init(struct nodm_display_manager* dm)
     nodm_xserver_init(&(dm->srv));
     nodm_xsession_init(&(dm->session));
     dm->_srv_split_args = NULL;
+    dm->_srv_split_argv = NULL;
 }
 
 void nodm_display_manager_cleanup(struct nodm_display_manager* dm)
@@ -46,6 +47,12 @@ void nodm_display_manager_cleanup(struct nodm_display_manager* dm)
         free(we);
         dm->_srv_split_args = NULL;
     }
+
+    if (dm->_srv_split_argv)
+    {
+        free(dm->_srv_split_argv);
+        dm->_srv_split_argv = NULL;
+    }
 }
 
 int nodm_display_manager_start(struct nodm_display_manager* dm)
@@ -156,6 +163,7 @@ int nodm_display_manager_parse_xcmdline(struct nodm_display_manager* s, const ch
     argv[argc] = NULL;
 
     s->srv.argv = (const char**)argv;
+    s->_srv_split_argv = argv;
     s->_srv_split_args = toks;
     argv = NULL;
     toks = NULL;
diff --git a/dm.h b/dm.h
index 9bdd197..04deaa7 100644
--- a/dm.h
+++ b/dm.h
@@ -34,6 +34,7 @@ struct nodm_display_manager
 
 
     /// Storage for split server arguments used by nodm_x_cmdline_split
+    char** _srv_split_argv;
     void* _srv_split_args;
 };
 
diff --git a/test-xsession.c b/test-xsession.c
index 6047183..6b17cac 100644
--- a/test-xsession.c
+++ b/test-xsession.c
@@ -54,7 +54,16 @@ void test_bad_x_server()
     dm.session.conf_cleanup_xse = false;
     dm.session.conf_run_as[0] = 0;
     dm.session.child_body = test_session;
+
     ensure_equali(nodm_display_manager_start(&dm), E_X_SERVER_DIED);
+
+    // If xserver died before being ready for connections, it should reflect on
+    // the tracked pid
+    ensure_equali(dm.srv.pid, -1);
+
+    // Session must not have been started
+    ensure_equali(dm.session.pid, -1);
+
     ensure_succeeds(nodm_display_manager_stop(&dm));
     nodm_display_manager_cleanup(&dm);
 }
diff --git a/xserver.c b/xserver.c
index 2a627ba..a67ede2 100644
--- a/xserver.c
+++ b/xserver.c
@@ -234,6 +234,12 @@ static int xserver_stop(struct nodm_xserver* srv)
     // TODO: wait
     srv->pid = -1;
     unsetenv("DISPLAY");
+
+    if (srv->windowpath != NULL)
+    {
+        free(srv->windowpath);
+        srv->windowpath = NULL;
+    }
     return E_SUCCESS;
 }
 

-- 
Automatic Display Manager



More information about the pkg-fso-commits mailing list