summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-03-30 20:12:50 +0200
committerThomas Haller <thaller@redhat.com>2023-04-04 08:43:21 +0200
commitf862d4bbcef704e539fa98d98eacd398e8c6c57a (patch)
treed1227bc560fe2822463c0271e3c3cbef0ad6b43a
parent64825b4f58489f64c6cde82c76c373264985b448 (diff)
ovsdb: use nm_auto_free cleanup attribute in "nm-ovsdb.c"
-rw-r--r--src/core/devices/ovs/nm-ovsdb.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/core/devices/ovs/nm-ovsdb.c b/src/core/devices/ovs/nm-ovsdb.c
index 50239be6c7..bac6235429 100644
--- a/src/core/devices/ovs/nm-ovsdb.c
+++ b/src/core/devices/ovs/nm-ovsdb.c
@@ -1445,7 +1445,7 @@ ovsdb_next_command(NMOvsdb *self)
{
NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE(self);
OvsdbMethodCall *call;
- char *cmd;
+ nm_auto_free char *cmd = NULL;
nm_auto_decref_json json_t *msg = NULL;
if (!priv->conn)
@@ -1586,7 +1586,6 @@ ovsdb_next_command(NMOvsdb *self)
cmd = json_dumps(msg, 0);
_LOGT_call(call, "send: call-id=%" G_GUINT64_FORMAT ", %s", call->call_id, cmd);
g_string_append(priv->output, cmd);
- free(cmd);
ovsdb_write(self);
}
@@ -2187,9 +2186,9 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
static void
ovsdb_got_echo(NMOvsdb *self, json_int_t id, json_t *data)
{
- NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE(self);
- nm_auto_decref_json json_t *msg = NULL;
- char *reply;
+ NMOvsdbPrivate *priv = NM_OVSDB_GET_PRIVATE(self);
+ nm_auto_decref_json json_t *msg = NULL;
+ nm_auto_free char *reply = NULL;
gboolean output_was_empty;
output_was_empty = priv->output->len == 0;
@@ -2197,7 +2196,6 @@ ovsdb_got_echo(NMOvsdb *self, json_int_t id, json_t *data)
msg = json_pack("{s:I, s:O}", "id", id, "result", data);
reply = json_dumps(msg, 0);
g_string_append(priv->output, reply);
- free(reply);
if (output_was_empty)
ovsdb_write(self);