Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewd

Dir     : e17/libs/ewd/src


Modified Files:
        ewd_hash.c 


Log Message:
Plug two possible mem leaks.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewd/src/ewd_hash.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewd_hash.c  8 Nov 2001 22:47:26 -0000       1.10
+++ ewd_hash.c  4 Feb 2004 02:07:33 -0000       1.11
@@ -165,6 +165,8 @@
                i++;
        }
 
+       FREE(hash->buckets);
+
        EWD_WRITE_UNLOCK(hash);
        EWD_DESTROY_LOCKS(hash);
 
@@ -431,7 +433,7 @@
        /*
         * Allocate a new bucket area, of the new larger size
         */
-       hash->buckets = (Ewd_List **)malloc(ewd_prime_table[hash->size] *
+       hash->buckets = (Ewd_List **)calloc(ewd_prime_table[hash->size],
                        sizeof(Ewd_List *));
 
        /*
@@ -443,12 +445,6 @@
                hash->size--;
                return FALSE;
        }
-
-       /*
-        * Clear out the newly allocated memory area
-        */
-       memset(hash->buckets, 0, ewd_prime_table[hash->size]
-                       * sizeof(Ewd_List *));
        hash->nodes = 0;
 
        /*
@@ -459,6 +455,11 @@
                return TRUE;
        }
 
+       /*
+        * Free the old buckets regardless of success.
+        */
+       FREE(old);
+
        return FALSE;
 }
 




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to