Skip to content

Commit

Permalink
ovsdb-idl: Fix memory leak sending messages without a session.
Browse files Browse the repository at this point in the history
When there's no open session, we still have to free the messages that
we make but cannot send.

I'm not confident that these fix actual bugs, because it seems possible
that these code paths can only be hit when the session is nonnull.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Ilya Maximets <[email protected]>
  • Loading branch information
blp committed Dec 19, 2020
1 parent 75439c4 commit de914f4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/ovsdb-idl.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,8 @@ ovsdb_idl_send_request(struct ovsdb_idl *idl, struct jsonrpc_msg *request)
idl->request_id = json_clone(request->id);
if (idl->session) {
jsonrpc_session_send(idl->session, request);
} else {
jsonrpc_msg_destroy(request);
}
}

Expand Down Expand Up @@ -4489,8 +4491,10 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn)
if (!any_updates) {
txn->status = TXN_UNCHANGED;
json_destroy(operations);
} else if (txn->db->idl->session
&& !jsonrpc_session_send(
} else if (!txn->db->idl->session) {
txn->status = TXN_TRY_AGAIN;
json_destroy(operations);
} else if (!jsonrpc_session_send(
txn->db->idl->session,
jsonrpc_create_request(
"transact", operations, &txn->request_id))) {
Expand Down Expand Up @@ -5198,6 +5202,8 @@ ovsdb_idl_set_lock(struct ovsdb_idl *idl, const char *lock_name)
}
if (idl->session) {
jsonrpc_session_send(idl->session, msg);
} else {
jsonrpc_msg_destroy(msg);
}
}
}
Expand Down

0 comments on commit de914f4

Please sign in to comment.