Skip to content

Bug: Potential memory leak due to improper cleanup/free logic #193

@arun-madhavan-013

Description

@arun-madhavan-013

Problem/Opportunity

Some areas where allocated memory does not get cleared.
Eg:

  1. https://github.com/rdkcentral/networkmanager/blob/develop/plugin/gnome/NetworkManagerGnomeWIFI.cpp#L1040
  2. https://github.com/rdkcentral/networkmanager/blob/develop/plugin/gnome/NetworkManagerGnomeWIFI.cpp#L1202
  3. https://github.com/rdkcentral/networkmanager/blob/develop/plugin/gnome/NetworkManagerGnomeWIFI.cpp#L1237
  4. Previous unref is missing before exiting.
  5. Missing wProxy and result unref before return.

Some areas where memory is cleared without any protection causing crashes.
Eg:

  1. https://github.com/rdkcentral/networkmanager/blob/develop/plugin/gnome/NetworkManagerGnomeProxy.cpp#L84
  2. https://github.com/rdkcentral/networkmanager/blob/develop/plugin/gnome/NetworkManagerGnomeWIFI.cpp#L56
  3. https://github.com/rdkcentral/networkmanager/blob/develop/plugin/gnome/NetworkManagerGnomeWIFI.cpp#L570

Suggestions:

  1. Analyze the codebase using heap check/memory leak detection tools (e.g., Valgrind, AddressSanitizer) to identify and resolve vulnerabilities.
  2. Add strict compile flags (such as -fsanitize=address, -Wall, -Wextra, -Werror) to enforce better memory management and catch issues during build time.

Consider making these checks mandatory in future development cycles.

Steps to reproduce

No response

Expected Behavior

NetworkManager shall not cause memory leak in any case.

Notes (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions