Xilinx / Xilinx/embeddedsw

Memory leaks in mcap_lib.c

Open
#10 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
1.2k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

The following memory leaks exist in mcap_lib.c. The line numbers are based on the following version of mcap_lib.c: "8826f30 on Nov 23, 2015"

  • Line 81 in MCapProcessRBT calls getline with raw = NULL. According to the getline man page "If lineptr is NULL, then getline() will allocate a buffer for storing the line, which should be freed by the user program.". raw is never freed.
  • Line 617 in MCapConfigureFPGA does not close fptr before returning
  • Line 649 in MCapConfigureFPGA does not free data or close fptr before returning
  • Line 654 in MCapConfigureFPGA does not free data or close fptr before returning

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read mcap_lib.c at the reported lines, starting with MCapProcessRBT and MCapConfigureFPGA. Trace the getline allocation and the listed return paths, then verify that raw, data, and fptr are cleaned up in each case; done means the reported leaks and unclosed file paths are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.