diff --git a/ChangeLog b/ChangeLog
index 9c1f3c031..7d3f85691 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-08-13 Paolo Nenzi
+
+ * src/frontend/device.c: "show" command leaked 28 bytes for each
+ group of words since an allocated pointer in line 33 of gens.c
+ was never freed. It is not possible to free allocated memory
+ using that pointer since it is used and its value altered. I
+ used "listdg" copying original pointer value to it and freeing
+ memory using "listdg" instead. There were sone "tfree" that
+ caused problems for incorrect inputs, I have removed them and
+ tested against some bad syntax. Results shows no leaks.
+
2004-08-09 Paolo Nenzi
* Updated and corrected test files in "tests" directory. Added
diff --git a/src/frontend/device.c b/src/frontend/device.c
index f9bcdbccd..e4d976be4 100644
--- a/src/frontend/device.c
+++ b/src/frontend/device.c
@@ -60,7 +60,7 @@ all_show(wordlist *wl, int mode)
wordlist *params, *nextgroup, *thisgroup;
wordlist *prev, *next, *w;
int screen_width;
- dgen *dg, *listdg;
+ dgen *dg, *listdg = NULL;
int instances;
int i, j, n;
int param_flag, dev_flag;
@@ -124,12 +124,16 @@ all_show(wordlist *wl, int mode)
else
thisgroup = next;
}
+ /*
tfree(w->wl_word);
tfree(w);
+ */
w = NULL;
} else if (eq(w->wl_word, ":")) {
+ /*
tfree(w->wl_word);
tfree(w);
+ */
w = NULL;
if (!params) {
params = next;
@@ -145,8 +149,10 @@ all_show(wordlist *wl, int mode)
}
} else if (eq(w->wl_word, ";") || eq(w->wl_word, ",")) {
nextgroup = next;
+ /*
tfree(w->wl_word);
tfree(w);
+ */
w = NULL;
if (prev)
prev->wl_next = NULL;
@@ -217,7 +223,12 @@ all_show(wordlist *wl, int mode)
printf("\n");
}
}
-
+ /* Paolo Nenzi 2004:
+ * This tfree is necessary to free memory allocated by NEW in
+ * dgen_init. It is not possible to free dg since it is casted
+ * to NULL from dgen_next and is lost.
+ */
+ tfree(listdg);
wl = nextgroup;
} while (wl);