GNS3 / GNS3/dynamips

Potential memory-leak

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

Nobody has claimed this yet.

bug
Dominant language
C
Stars
405
Forks
99
Avg merge
3m
Merged PRs (30d)
1

Description

Hi, I have found a potential memory-leak bug in the project and would like to report it to the maintainers. Can you please help me to check it? Thank you for your effort and patience!

In function pci_dev_add in file common/pci_dev.c, dev is assigned with newly allocated memory at line 295 and then assigned to pci_bus->dev_list at line 320, wherepci_bus is the 1st param of the function. In function dev_c2600_pci_init (in file common/dev_c2600_pci.c) , d->bus is used as the 1st param of call for pci_dev_add at line 193 and d is a local variable. The allocated memory (d->bus->dev_list) is not freed, which may cause a memory-leak bug.

Image

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 common/pci_dev.c at pci_dev_add and common/dev_c2600_pci.c at dev_c2600_pci_init. Trace the lifetime of dev_list after d->bus is passed to pci_dev_add, checking whether another cleanup path exists. Done means the allocation's ownership is accounted for and the reported leak is confirmed or disproved.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.