[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Some free()s in module 'relocatable'
From: |
Sylvain Beucler |
Subject: |
Some free()s in module 'relocatable' |
Date: |
Wed, 26 Dec 2007 21:47:21 +0100 |
User-agent: |
Mutt/1.5.17 (2007-11-01) |
Hello,
Attached is a small patch to fix a couple non-fred memory blocks. They
are not a big deal, but they do produce noise when analyzing programs
with memory checkers such as Valgrind.
Another thing:, the relocatable module documentation recommends using:
bindtextdomain (PACKAGE, relocate (LOCALEDIR));
however, the result of relocate may be LOCALEDIR itself (no
relocation) or a newly allocated string. Currently I need to use
tricks to properly free() the result of relocate():
default_data_dir = strdup(DEFAULT_DATA_DIR); /* no '!=' with constants */
datadir_relocatable = relocate(default_data_dir);
... use datadir_relocatable ...
if (datadir_relocatable != default_data_dir)
free((char *)datadir_relocatable); /* force non-const variable */
Maybe it would be cleaner to always return a newly allocated string?
Cheers,
--
Sylvain
- Some free()s in module 'relocatable',
Sylvain Beucler <=