Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny memory leak #6

Open
alistairking opened this issue Jul 21, 2016 · 1 comment
Open

Tiny memory leak #6

alistairking opened this issue Jul 21, 2016 · 1 comment

Comments

@alistairking
Copy link
Member

I think there is a tiny memory leak when this if statement: https://github.com/CAIDA/libipmeta/blob/master/lib/providers/ipmeta_provider_netacq_edge.c#L1364
evaluates to false (i.e., when the record should be ignored). In this case fields in the tmp structure that are strdup'd are lost. These fields should be manually free'd, or perhaps expose the utility function at:
https://github.com/CAIDA/libipmeta/blob/master/lib/ipmeta_provider.c#L72)

@NullHypothesis
Copy link

Yes, there's indeed a memory leak here. We confirmed this while testing a patch over at CAIDA/bgpview#5.

Here's the valgrind output:

==47277==    at 0x4C2266F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==47277==    by 0x6F2E0AD: strndup (in /lib/libc.so.7)
==47277==    by 0x52A8551: parse_country_cell (ipmeta_provider_netacq_edge.c:1226)
==47277==    by 0x4E34A03: csv_parse (libcsv.c:400)
==47277==    by 0x52A5691: read_countries (ipmeta_provider_netacq_edge.c:1394)
==47277==    by 0x52A75FA: ipmeta_provider_netacq_edge_init (ipmeta_provider_netacq_edge.c:1976)
==47277==    by 0x529DE1F: ipmeta_provider_init (ipmeta_provider.c:164)
==47277==    by 0x529CFD2: ipmeta_enable_provider (ipmeta.c:110)
==47277==    by 0x506B2BD: init_ipmeta.isra.1 (bvc_pergeovisibility.c:716)
==47277==    by 0x506D6D6: bvc_pergeovisibility_init (bvc_pergeovisibility.c:1334)
==47277==    by 0x5068563: consumer_init (bgpview_consumer_manager.c:225)
==47277==    by 0x5068563: bgpview_consumer_manager_enable_consumer (bgpview_consumer_manager.c:359)
==47277==    by 0x50685D9: bgpview_consumer_manager_enable_consumer_from_str (bgpview_consumer_manager.c:395)

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

No branches or pull requests

2 participants