memory leak in libxdg-basedir 1.2.0 (xdgFreeData() does not free cache->runtimeDirectory)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libxdg-basedir (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I'm basically copying and pasting the following paragraphs from https:/
Description of problem:
libxdg-basedir has an internal state allocated by xdgInitHandle() and deallocated by calling xdgWipeHandle(). xdgWipeHandle() calls xdgFreeData(), which is supposed to free all memory allocated to the handle.
Unfortunately, it does not free the string cache->
This bug seems to have been introduced in upstream commit 648873a319772ab
Unfortunately, the upstream project at http://
I have attached a simple patch as "basedir.c.patch" that frees cache->
Version-Release number of selected component (if applicable):
libxdg-
How reproducible:
Every time. The cleanup function xdgFreeData() does not properly free cache->
Steps to Reproduce:
1. Compile the test program listed under "additional info" by "gcc -o foo foo.c -l xdg-basedir"
2. Run program through valgrind
3. Observe memory leak
Actual results:
xdgFreeData() does not free cache->
[snip]
==777== 15 bytes in 1 blocks are definitely lost in loss record 11 of 15
==777== at 0x4C28409: malloc (in /usr/lib64/
==777== by 0x5BF4429: strdup (in /usr/lib64/
==777== by 0x504176D: xdgUpdateData (in /usr/lib64/
==777== by 0x50419C4: xdgInitHandle (in /usr/lib64/
[snap]
Expected results:
xdgFreeData() should free cache->
Additional info:
Here's a small test program that triggers this bug:
#include <basedir.h>
int main()
{
xdgHandle xdg_handle;
return 0;
}
Status changed to 'Confirmed' because the bug affects multiple users.