#5920 closed Bug (fixed)
Default configuration directory is PREFIX/local/share/locale when XDG_CONFIG_HOME is set.
Reported by: | jyelloz | Owned by: | mike.dld |
---|---|---|---|
Priority: | Normal | Milestone: | 2.90 |
Component: | libtransmission | Version: | 2.84+ |
Severity: | Normal | Keywords: | |
Cc: |
Description
In builds of the latest subversion code, if you have XDG_CONFIG_HOME set, the configuration directory is loaded from PREFIX/local/share/locale. This is due to an incorrect freeing of the configuration path, facilitated by the unfortunate practice of reassigning variables in any programming language.
It looks to be caused by a free after assignment which is not easily justified in any context: https://trac.transmissionbt.com/browser/trunk/libtransmission/platform.c?rev=14487&annotate=blame#L333
I have written a patch which I believe fixes the problem and avoids a memory leak when loading the environment variable value.
Attachments (1)
Change History (5)
Changed 6 years ago by jyelloz
comment:2 Changed 6 years ago by mike.dld
Thanks for noticing this! Although I'd expect crash report upon accessing freed memory block but it seems that heap manager cuts us some slack here by not really freeing the memory just yet.
I've adjusted your patch a bit to get rid of compiler warning passing argument 1 of ‘tr_free’ discards ‘const’ qualifier from pointer target type (you should not pass pointers to constant data to free()) and make sure that tr_free() is only called with non-NULL argument. I've also made comparison against NULL explicit, that's my personal preference really but I think it makes code more readable. Committed as r14488.
comment:3 Changed 6 years ago by mike.dld
- Owner changed from jordan to mike.dld
- Status changed from new to assigned
comment:4 Changed 6 years ago by mike.dld
- Milestone changed from None Set to 2.90
- Resolution set to fixed
- Status changed from assigned to closed
a patch to fix the bug