Skip to content

Commit cd384b4

Browse files
committed
json: do not leak port_obj for PCI devices
When the transport is pcie the port_obj is leaked. Signed-off-by: Daniel Wagner <wagi@kernel.org>
1 parent 855525b commit cd384b4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/nvme/json.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,10 @@ static void json_update_port(struct json_object *ctrl_array, nvme_ctrl_t c)
287287
const char *transport, *value;
288288

289289
transport = nvme_ctrl_get_transport(c);
290-
if (!strcmp(transport, "pcie"))
290+
if (!strcmp(transport, "pcie")) {
291+
json_object_put(port_obj);
291292
return;
293+
}
292294

293295
json_object_object_add(port_obj, "transport",
294296
json_object_new_string(transport));

0 commit comments

Comments
 (0)