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: 830a5a14cb
(cherry picked from commit 29984c07cd)
This commit is contained in:
Beniamino Galvani 2019-02-11 17:54:48 +01:00
parent 9d291821f2
commit 583a2a2cee

View file

@ -1292,6 +1292,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");
@ -1528,11 +1531,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;