Bug 55776

Summary: Crash when server_init_sync() fails in polkit-agent
Product: PolicyKit Reporter: Adam Jackson <ajax>
Component: daemonAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: RESOLVED FIXED QA Contact: David Zeuthen (not reading bugmail) <zeuthen>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Adam Jackson 2012-10-08 19:14:46 UTC
First, a fix:

===
diff -up polkit-0.107/src/polkitagent/polkitagentlistener.c.jx polkit-0.107/src/polkitagent/polkitagentlistener.c
--- polkit-0.107/src/polkitagent/polkitagentlistener.c.jx	2012-04-24 12:05:34.000000000 -0400
+++ polkit-0.107/src/polkitagent/polkitagentlistener.c	2012-10-08 13:17:27.884850539 -0400
@@ -260,10 +260,9 @@ server_new (PolkitSubject  *subject,
   if (!server_init_sync (server, cancellable, error))
     {
       server_free (server);
-      goto out;
+      return NULL;
     }
 
- out:
   return server;
 }
 
===

Note that otherwise we return a freed server object.  Since later in polkit_agent_listener_register_with_options we check against NULL to determine failure, this makes for sad times later when we call server_free() on it again.
Comment 1 David Zeuthen (not reading bugmail) 2012-10-09 18:11:04 UTC
Committed to master, thanks

http://cgit.freedesktop.org/polkit/commit/?id=59f2d96ce3ac63173669f299a9453a7bf5e70a70

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.