Bug 3028 - small mem leak
Summary: small mem leak
Status: RESOLVED FIXED
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Tollef Fog Heen
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-14 03:28 UTC by Paolo Borelli
Modified: 2009-04-26 07:59 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Paolo Borelli 2005-04-14 03:28:12 UTC
out of curiosity, after compiling 0.17.2 I run

valgrind --tool=memcheck --leak-check=yes --num-callers=20 pkg-config --libs
--cflags gtk+-2.0

and spotted this small memleak

==3227== 850 bytes in 73 blocks are definitely lost in loss record 6 of 11
==3227==    at 0x1B904EDD: malloc (vg_replace_malloc.c:131)
==3227==    by 0x805179A: g_malloc (gmem.c:177)
==3227==    by 0x8054CB3: g_strdup (gstrfuncs.c:56)
==3227==    by 0x804AF9E: package_get_var (pkg.c:1235)
==3227==    by 0x804B87D: trim_and_sub (parse.c:195)
==3227==    by 0x804C81F: parse_line (parse.c:934)
==3227==    by 0x804CB82: parse_package_file (parse.c:984)
==3227==    by 0x8049A9C: internal_get_package (pkg.c:323)
==3227==    by 0x8049CC2: get_package (pkg.c:370)
==3227==    by 0x804E04B: main (main.c:458)

it looks like you need to g_free varval in parse.c::trim_and_sub (~ line 207)
Comment 1 Paolo Borelli 2005-04-14 03:44:12 UTC
along the sameline, it looks like you need to closedir(dir) in pkg.c::scan_dir
(~ line 200)
Comment 2 Jason Leach 2009-04-26 07:59:54 UTC
These were both resolved about a month after this report, nearly four years ago. From the ChangeLog (some lines skipped):

2005-05-21  Tollef Fog Heen  <tfheen@err.no>

	* pkg.c: (scan_dir): Use the correct free function.  Stop leaking file
	descriptors.

	* parse.c (trim_and_sub): Fix memory leak.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.