[srm-cvs] CVS Update: - Fixed some more memory leaks

From: <d.rethans[@]jdimedia.nl>
Date: Sun Feb 16 2003 - 01:25:17 CET

Date: Sun Feb 16 01:25:15 CET 2003
User: Derick Rethans
Directory: srm/main/src

Log Message:
 [0.50]
 - Fixed some more memory leaks
 #- Don't be afraid, those were only one time leaks from starting up...
 
Modified files:
           srm/main/main.c (version: 1.68)
           srm/main/src/srm_error.c (version: 1.28)
           srm/main/src/srm_ini_parser.y (version: 1.18)
           srm/main/src/srm_llist.c (version: 1.12)
           srm/main/src/srm_modules.c (version: 1.68)
           srm/main/src/srm_modules.h (version: 1.36)
           srm/main/src/srm_protocols.c (version: 1.3)

[FILE: /srm/main/main.c]

--- srm/main/main.c:1.67 Sat Feb 15 22:23:06 2003 GMT
+++ srm/main/main.c Sat Feb 15 23:25:14 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.67 2003/02/15 23:23:06 derick Exp $ */
+/* $Id: cvstemp,v 1.68 2003/02/16 00:25:14 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -383,6 +383,7 @@
 /* unload_ini_settings (); */
 
         srm_stop_logging ();
+ srm_cleanup_ini_settings();
 
 /* Closing sockets */
         for (fd = 0; fd < CP.max_fd; fd++) {

[FILE: /srm/main/src/srm_error.c]

--- srm/main/src/srm_error.c:1.27 Sat Feb 15 19:45:09 2003 GMT
+++ srm/main/src/srm_error.c Sat Feb 15 23:25:14 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.27 2003/02/15 20:45:09 derick Exp $ */
+/* $Id: cvstemp,v 1.28 2003/02/16 00:25:14 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -56,6 +56,7 @@
 void srm_stop_logging (void)
 {
         srm_fmt_message (LL_SHUTDOWN, "Log", "Logfile ended");
+ fclose(logfile);
 }
 
 /* The funcions in here will be replaced with functionality for callbacks

[FILE: /srm/main/src/srm_ini_parser.y]

--- srm/main/src/srm_ini_parser.y:1.17 Sat Feb 15 22:53:54 2003 GMT
+++ srm/main/src/srm_ini_parser.y Sat Feb 15 23:25:14 2003 GMT
@@ -1,5 +1,5 @@
 %{
-/* $Id: cvstemp,v 1.17 2003/02/15 23:53:54 derick Exp $ */
+/* $Id: cvstemp,v 1.18 2003/02/16 00:25:14 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -17,7 +17,8 @@
  * Group. Portions created by Vulcan Logic Group are Copyright (C)
  * 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
  *
- * Contributor(s):
+ * Contributor(s):
+ * Derick Rethans <d.rethans@jdimedia.nl>
  */
 
 #include <stdio.h>
@@ -32,6 +33,8 @@
 extern char *srm_ini_text;
 extern int srm_ini_lineno;
 
+extern void srm_module_list_dtor(void *, void *);
+
 /* Functino prototypes */
 extern int srm_ini_lex (void);
 int srm_ini_error (char *s);
@@ -47,7 +50,7 @@
 srm_value *tmp_val;
 char *tmp_key;
 int tmp_key_len;
-char *module_path;
+char *module_path = NULL;
 char *tmp_module_path;
 
 #define SRM_INI_GET_SETTING \
@@ -204,7 +207,7 @@
 
         /* Initialising variables */
         config_hash = srm_value_init();
- module_list = srm_llist_alloc (NULL);
+ module_list = srm_llist_alloc(srm_module_list_dtor);
 
         /* Preparing hash for settings */
         VALP_SET_HASH(config_hash);
@@ -214,8 +217,18 @@
         /* Setting up lex environment and starting parse */
         srm_ini_in = ini_file;
         srm_ini_parse();
+ fclose(ini_file);
 
         return SRM_SUCCESS;
+}
+
+void srm_cleanup_ini_settings (void)
+{
+ srm_value_free(config_hash);
+
+ if (module_path) {
+ free(module_path);
+ }
 }
 
 srm_bool srm_get_ini_bool (char* group, char *key, srm_bool def)

[FILE: /srm/main/src/srm_llist.c]

--- srm/main/src/srm_llist.c:1.11 Mon Feb 11 21:29:12 2002 GMT
+++ srm/main/src/srm_llist.c Sat Feb 15 23:25:15 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.11 2002/02/11 22:29:12 sterling Exp $ */
+/* $Id: cvstemp,v 1.12 2003/02/16 00:25:15 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -120,7 +120,9 @@
                         e->next->prev = e->prev;
         }
 
- l->dtor(user, e->ptr);
+ if (l->dtor) {
+ l->dtor(user, e->ptr);
+ }
         free(e);
         --l->size;
 

[FILE: /srm/main/src/srm_modules.c]

--- srm/main/src/srm_modules.c:1.67 Sat Jan 18 15:11:29 2003 GMT
+++ srm/main/src/srm_modules.c Sat Feb 15 23:25:15 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.67 2003/01/18 16:11:29 derick Exp $ */
+/* $Id: cvstemp,v 1.68 2003/02/16 00:25:15 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -352,6 +352,11 @@
         }
 }
 
+void srm_module_list_dtor (void *dummy, void* value)
+{
+ free((char *) value);
+}
+
 /*
  * Unload modules
  */
@@ -368,6 +373,7 @@
  */
         srm_hash_destroy (function_hash);
         srm_hash_destroy (module_hash);
+ srm_llist_destroy (module_list, NULL);
 }
 
 

[FILE: /srm/main/src/srm_modules.h]

--- srm/main/src/srm_modules.h:1.35 Sun Jul 07 17:22:44 2002 GMT
+++ srm/main/src/srm_modules.h Sat Feb 15 23:25:15 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.35 2002/07/07 19:22:44 derick Exp $ */
+/* $Id: cvstemp,v 1.36 2003/02/16 00:25:15 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -197,6 +197,9 @@
         srm_hash* (*srm_get_ini_hash)(char*, char*, srm_hash*);
 } t_ini_setting_callers;
 
+/* Function to clean up INI settings hash */
+void srm_cleanup_ini_settings(void);
+
 /* Functions */
 int srm_modulelist_init(void);
 
@@ -204,6 +207,7 @@
 void srm_startup_modules(s_module_entry **ptr, int count);
 void srm_startup_internal_modules(void);
 
+void srm_module_list_dtor (void *dummy, void* value);
 void srm_unload_modules(void);
 void srm_shutdown_modules(s_module_entry **ptr, int count);
 void srm_shutdown_internal_modules(void);

[FILE: /srm/main/src/srm_protocols.c]

--- srm/main/src/srm_protocols.c:1.2 Sat Feb 15 22:23:07 2003 GMT
+++ srm/main/src/srm_protocols.c Sat Feb 15 23:25:15 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.2 2003/02/15 23:23:07 derick Exp $ */
+/* $Id: cvstemp,v 1.3 2003/02/16 00:25:15 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -68,6 +68,7 @@
         for (i = 0; i < srm_protocol_count; i++) {
                 if (srm_protocol_list[i]->host.host) {
                         free(srm_protocol_list[i]->host.host);
+ free(srm_protocol_list[i]);
                 }
         }
 }
Received on Sun Feb 16 01:25:17 2003

This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 09:00:03 CET