[Initng-svn] r3004 - initng/plugins/history
svn at initng.thinktux.net
svn at initng.thinktux.net
Thu Feb 16 13:27:09 CET 2006
Author: jimmy
Date: Thu Feb 16 13:27:09 2006
New Revision: 3004
Modified:
initng/plugins/history/initng_history.c
Log:
Now history plugin really free its data.
Modified: initng/plugins/history/initng_history.c
==============================================================================
--- initng/plugins/history/initng_history.c (original)
+++ initng/plugins/history/initng_history.c Thu Feb 16 13:27:09 2006
@@ -116,18 +116,36 @@
/* check length of history_db, and purge it on the end! */
history_records++;
+ /* If maximum entrys are reached */
if (history_records > HISTORY)
{
struct list_head *last = history_db.list.prev;
history_h *entry = list_entry(last, history_h, list);
- if ((entry) && entry->name)
- free(entry->name);
-
- list_del(last);
- free(entry);
- history_records--;
+ /* if we got anything */
+ if(!entry)
+ {
+ F_("Unable to free last histroty entry!, cant add more.\n");
+ return(FALSE);
+ }
+
+ /* free the name */
+ if (entry->name)
+ free(entry->name);
+
+ /* free any data that might be in this history entry */
+ if (entry->data)
+ free(entry->data);
+
+ /* delete this from the historylist */
+ list_del(last);
+
+ /* free the struct */
+ free(entry);
+
+ /* count down the number of records */
+ history_records--;
}
/* leave */
More information about the Initng-svn
mailing list