summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-02-11 17:54:48 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2019-02-17 19:39:08 +0100
commit29984c07cdd6ca00831bafc23ed7604abea7569e (patch)
tree2167dd8a2269316e4270176b6bb891a54ce0c509
parentb92f2c932310e0ab2c94af9824f2e683af773204 (diff)
downloadNetworkManager-29984c07cdd6ca00831bafc23ed7604abea7569e.tar.gz
ovs: fix dispose()
input and output must be freed only when not NULL. Also, ovsdb_disconnect() should do nothing if there is no client. Fixes: 830a5a14cb29ca00b73a9623c1ea7c5cd92f4d00
-rw-r--r--src/devices/ovs/nm-ovsdb.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c
index 6fef75b612..9d73c3ac71 100644
--- a/src/devices/ovs/nm-ovsdb.c
+++ b/src/devices/ovs/nm-ovsdb.c
@@ -1291,6 +1291,9 @@ ovsdb_disconnect (NMOvsdb *self, gboolean is_disposing)
gpointer user_data;
gs_free_error GError *error = NULL;
+ if (!priv->client)
+ return;
+
_LOGD ("disconnecting from ovsdb");
nm_utils_error_set_cancelled (&error, is_disposing, "NMOvsdb");
@@ -1527,11 +1530,14 @@ dispose (GObject *object)
ovsdb_disconnect (self, TRUE);
- g_string_free (priv->input, TRUE);
- priv->input = NULL;
- g_string_free (priv->output, TRUE);
- priv->output = NULL;
-
+ if (priv->input) {
+ g_string_free (priv->input, TRUE);
+ priv->input = NULL;
+ }
+ if (priv->output) {
+ g_string_free (priv->output, TRUE);
+ priv->output = NULL;
+ }
if (priv->calls) {
g_array_free (priv->calls, TRUE);
priv->calls = NULL;