dict_clone: Fix memory leak. 20120728000505/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 27 Jul 2012 19:59:54 +0000 (21:59 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 27 Jul 2012 19:59:54 +0000 (21:59 +0200)
The encoding is already set in dict_create, so this assignment is
redunant and leaks memory.

Reviewed-by: Ben Pfaff.
src/data/dictionary.c

index b9efb2b1f74cde7e72f58aa41cce7a0503dfa488..f65c6a063e1ab99cf918da6df19d3bdb6ea0145e 100644 (file)
@@ -194,10 +194,6 @@ dict_clone (const struct dictionary *s)
 
   d = dict_create (s->encoding);
 
-  /* Set the new dictionary's encoding early so that string length limitations
-     are interpreted correctly. */
-  d->encoding = xstrdup (s->encoding);
-
   for (i = 0; i < s->var_cnt; i++)
     {
       struct variable *sv = s->var[i].var;