[xml] Fix for hash.c



xmlHashTable.table is of type xmlHashEntry **, so as long as I'm not being
stupid (which is always a possibility =), we should be allocating size *
sizeof(xmlHashEntryPtr) bytes:

Anthony


--- hash.c      2001/12/31 16:15:57     1.17
+++ hash.c      2002/01/14 17:23:11
@@ -103,9 +103,9 @@
     if (table) {
         table->size = size;
        table->nbElems = 0;
-        table->table = xmlMalloc(size * sizeof(xmlHashEntry));
+        table->table = xmlMalloc(size * sizeof(xmlHashEntryPtr));
         if (table->table) {
-           memset(table->table, 0, size * sizeof(xmlHashEntry));
+           memset(table->table, 0, size * sizeof(xmlHashEntryPtr));
            return(table);
         }
         xmlFree(table);
@@ -144,12 +144,12 @@
     if (oldtable == NULL)
         return(-1);
   
-    table->table = xmlMalloc(size * sizeof(xmlHashEntry));
+    table->table = xmlMalloc(size * sizeof(xmlHashEntryPtr));
     if (table->table == NULL) {
        table->table = oldtable;
        return(-1);
     }
-    memset(table->table, 0, size * sizeof(xmlHashEntry));
+    memset(table->table, 0, size * sizeof(xmlHashEntryPtr));
     table->size = size;
 
     for (i = 0; i < oldsize; i++) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]