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

From: <d.rethans[@]jdimedia.nl>
Date: Sun Feb 16 2003 - 00:48:59 CET

Date: Sun Feb 16 00:48:58 CET 2003
User: Derick Rethans
Directory: srm/main/src

Log Message:
 [0.25]
 - Fixed some memory leaks
 
Modified files:
           srm/main/src/srm_ini_scanner.l (version: 1.11)
           srm/main/src/srm_storage.c (version: 1.34)

[FILE: /srm/main/src/srm_ini_scanner.l]

--- srm/main/src/srm_ini_scanner.l:1.10 Wed Nov 27 12:08:40 2002 GMT
+++ srm/main/src/srm_ini_scanner.l Sat Feb 15 22:48:58 2003 GMT
@@ -1,5 +1,5 @@
 %{
-/* $Id: cvstemp,v 1.10 2002/11/27 13:08:40 derick Exp $ */
+/* $Id: cvstemp,v 1.11 2003/02/15 23:48:58 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
@@ -54,7 +54,7 @@
                         }
 
 [a-z][a-z0-9_]+ {
- srm_ini_lval.sval = (char*) strdup (yytext);
+ srm_ini_lval.sval = yytext;
                                 return LABEL;
                         }
 

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

--- srm/main/src/srm_storage.c:1.33 Sun Jan 26 15:34:11 2003 GMT
+++ srm/main/src/srm_storage.c Sat Feb 15 22:48:58 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.33 2003/01/26 16:34:11 derick Exp $ */
+/* $Id: cvstemp,v 1.34 2003/02/15 23:48:58 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,9 +56,9 @@
                                 /* File could be opened, proceed with reading */
                                 fread (data, finfo.st_size, 1, dump);
                                 fclose (dump);
- free (filename);
 
                                 deserialize (data, finfo.st_size, (struct srm_value**) &sval_temp, 0);
+ free (data);
 
                                 hash_temp = sval_temp->hash;
                                 /* Invalidate hash, so that srm_value_free can be called */
@@ -66,6 +66,7 @@
                                 VALP_SET_NULL(sval_temp);
                                 srm_value_free (sval_temp);
                                 if (hash_temp != NULL) { /* Only return with correct hash */
+ free (filename);
                                         return hash_temp;
                                 } else { /* else issue warning and fall through */
                                         srm_fmt_message (LL_STARTUP, "Store", "Deserialization of hash has failed");
@@ -75,6 +76,8 @@
                         srm_fmt_message (LL_STARTUP, "Store", "Could not load dump of session data");
                 }
         }
+ free (filename);
+
         /* Some error occured, so create a new hash table and return it */
         if ((hash_temp = srm_hash_alloc(size, SRM_VALUE_FREE)) != NULL) {
                 return hash_temp;
@@ -123,6 +126,9 @@
         } else {
                 srm_fmt_message (LL_SHUTDOWN, "Store", "Could not create dump (%s/%s) of session data", path, fname);
         }
+ srm_value_free(dump_val);
+ free(data);
+ free(filename);
         umask(0);
 }
 
Received on Sun Feb 16 00:49:00 2003

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