From e4d237d86b0487cc7b3699fa8246a69fbb31d3ed Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 20 Feb 2018 13:43:49 +0100 Subject: [PATCH] ovs: don't consume error in method callback The error should be freed by callback functions, but only _monitor_bridges_cb() actually does it. Simplify this by letting the caller own the error. Fixes: 830a5a14cb29ca00b73a9623c1ea7c5cd92f4d00 (cherry picked from commit 878a3a4125e07b3f82d7ed7b418021ae1398aaae) --- src/devices/ovs/nm-ovsdb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c index 6b45e6f426..92fcfa0139 100644 --- a/src/devices/ovs/nm-ovsdb.c +++ b/src/devices/ovs/nm-ovsdb.c @@ -1316,15 +1316,13 @@ ovsdb_disconnect (NMOvsdb *self, gboolean is_disposing) OvsdbMethodCall *call; OvsdbMethodCallback callback; gpointer user_data; - GError *error; + gs_free_error GError *error = NULL; _LOGD ("disconnecting from ovsdb"); + nm_utils_error_set_cancelled (&error, is_disposing, "NMOvsdb"); while (priv->calls->len) { - error = NULL; call = &g_array_index (priv->calls, OvsdbMethodCall, priv->calls->len - 1); - nm_utils_error_set_cancelled (&error, is_disposing, "NMOvsdb"); - callback = call->callback; user_data = call->user_data; g_array_remove_index (priv->calls, priv->calls->len - 1); @@ -1347,8 +1345,6 @@ _monitor_bridges_cb (NMOvsdb *self, json_t *result, GError *error, gpointer user _LOGI ("%s", error->message); ovsdb_disconnect (self, FALSE); } - - g_clear_error (&error); return; }