Fix segmentation faults and remove an unused variable
authorFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>
Wed, 8 Aug 2012 12:54:53 +0000 (13:54 +0100)
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>
Wed, 8 Aug 2012 14:32:05 +0000 (15:32 +0100)
Fix a segmentation fault in target_startup_monitor_finalize caused by
freeing the data of a list item instead of the actual unit list we want
to free.

Fix another possible segmentation fault in
la_handler_service_handle_consumer_lifecycle_request_finish caused by
logging a message using the wrong GError.

Remove an unused variable in la_handler_service_handle_register.

NEWS
node-startup-controller/la-handler-service.c
node-startup-controller/target-startup-monitor.c

diff --git a/NEWS b/NEWS
index 199ef8f..cb94f51 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ x.y.z
 * Simplify g_variant_lookup_value_with_int_key() to avoid license
   issues (the previously implementation was based on code from
   GLib)
+* Fix segmentation fault in TargetStartupMonitor.
+* Fix segmentation fault in LAHandlerService.
 * Add documentation for the GLib extension functions.
 * Add documentation for the JobManager class
 * Add documentation for the LAHandlerService class
index d968c80..7dc9b49 100644 (file)
@@ -351,7 +351,6 @@ la_handler_service_handle_register (LAHandler             *interface,
        * re-register its client with the new shutdown mode and timeout */
 
       /* extract information from the client */
-      consumer = shutdown_client_get_consumer (client);
       existing_bus_name = shutdown_client_get_bus_name (client);
       existing_object_path = shutdown_client_get_object_path (client);
 
@@ -560,7 +559,7 @@ la_handler_service_handle_consumer_lifecycle_request_finish (JobManager  *manage
       DLT_LOG (la_handler_context, DLT_LOG_ERROR,
                DLT_STRING ("Failed to notify NSM about completed lifecycle request:"),
                DLT_STRING ("request id"), DLT_UINT (data->request_id),
-               DLT_STRING ("error message"), DLT_STRING (error->message));
+               DLT_STRING ("error message"), DLT_STRING (err->message));
       g_error_free (err);
     }
   else if (error_status == NSM_ERROR_STATUS_OK)
index 4a425cf..33cf463 100644 (file)
@@ -215,7 +215,9 @@ target_startup_monitor_finalize (GObject *object)
                                             0, 0, NULL, NULL, monitor);
       g_object_unref (lp->data);
     }
-  g_list_free (lp->data);
+
+  /* release the list of systemd units */
+  g_list_free (monitor->units);
 
   /* release the mapping of systemd targets to node states */
   g_hash_table_destroy (monitor->targets_to_states);