projects
/
pspp-builds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
33e6106
)
dictionary: Fix memory leak in dict_set_encoding().
author
Ben Pfaff
<blp@cs.stanford.edu>
Fri, 9 Apr 2010 04:12:02 +0000
(21:12 -0700)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Mon, 12 Apr 2010 03:39:03 +0000
(20:39 -0700)
If this function was called more than once for a given dictionary then all
but the final encoding name would be leaked.
src/data/dictionary.c
patch
|
blob
|
history
diff --git
a/src/data/dictionary.c
b/src/data/dictionary.c
index f69d91e3605ed246302740c74e1cb2f47ef3d8f7..bca92dabe300b4c34439845c47abf485c900a778 100644
(file)
--- a/
src/data/dictionary.c
+++ b/
src/data/dictionary.c
@@
-81,7
+81,10
@@
void
dict_set_encoding (struct dictionary *d, const char *enc)
{
if (enc)
- d->encoding = xstrdup (enc);
+ {
+ free (d->encoding);
+ d->encoding = xstrdup (enc);
+ }
}
const char *