Bug 8117 - Memory leak in get_cwd
Summary: Memory leak in get_cwd
Status: CLOSED FIXED
Alias: None
Product: ccache
Classification: Unclassified
Component: ccache (show other bugs)
Version: 3.1.4
Hardware: All All
: P5 normal
Target Milestone: 3.1.5
Assignee: Joel Rosdahl
QA Contact: Joel Rosdahl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-03 16:37 UTC by Bo Rydberg
Modified: 2011-05-29 15:52 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bo Rydberg 2011-05-03 16:37:36 UTC
In util.c get_cwd is defined. When returning in the last if-statement, x_strdup is called and its value returned. But to local owner, cwd, is not freed, causing a small memory leak for that situation.

Suggest adding a free before line 1001, thus changing from

1001:		return x_strdup(pwd);

to

1001:		free(cwd);
1002:		return x_strdup(pwd);
Comment 1 Joel Rosdahl 2011-05-04 20:35:55 UTC
Thanks, fixed in a760f7e3200ac3ac44240ec5783c97c530f3676e.
Comment 2 Joel Rosdahl 2011-05-29 15:52:03 UTC
Included in v3.1.5.