Skip to content

Fix/mdevices info leak - #1801

Open
JarodCohen wants to merge 3 commits into
Mellanox:master_develfrom
JarodCohen:fix/mdevices-info-leak
Open

Fix/mdevices info leak#1801
JarodCohen wants to merge 3 commits into
Mellanox:master_develfrom
JarodCohen:fix/mdevices-info-leak

Conversation

@JarodCohen

Copy link
Copy Markdown
Contributor

Summary

  • Fix a resource leak in mdevices_info() when mopen() fails while filtering devices without VSEC support.
  • On the error path, free dev_info_all via mdevices_info_destroy() before returning NULL.
  • Coverity: RESOURCE_LEAK / CID 871786 (leaked_storage on dev_info_all).

Jarod Cohen and others added 3 commits April 16, 2026 13:24
On the mopen() failure path, mdevices_info() freed dev_info_new but
returned without releasing dev_info_all (allocated by mdevices_info_ul),
leaking the device array and its nested allocations. Release it via
mdevices_info_destroy() before returning NULL. Saves the original length
into dev_count first since *len is zeroed for the caller.

Coverity: RESOURCE_LEAK / leaked_storage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant