]> granicus.if.org Git - recode/commitdiff
Coverity: RESOURCE_LEAK
authorJiri Popelka <jpopelka@redhat.com>
Thu, 23 Jun 2011 13:24:52 +0000 (15:24 +0200)
committerJiri Popelka <jpopelka@redhat.com>
Thu, 23 Jun 2011 14:26:32 +0000 (16:26 +0200)
src/hash.c:783: var_assign: Assigning: "new_table" =  storage returned from
                "hash_initialize(candidate, table->tuning, table->hasher,
                                 table->comparator, table->data_freer)".
src/hash.c:816: leaked_storage: Variable "new_table" going out of scope
                                leaks the storage it points to.

src/html.c:428: var_assign: Assigning: "table" =  storage returned from
                "hash_initialize(0U, NULL, code_hash, code_compare, NULL)".
src/html.c:436: leaked_storage: Variable "table" going out of scope
                                leaks the storage it points to.

src/html.c:609: var_assign: Assigning: "table" =  storage returned from
                "hash_initialize(0U, NULL, string_hash, string_compare, NULL)".
src/html.c:617: leaked_storage: Variable "table" going out of scope
                                leaks the storage it points to.

src/request.c:758: var_assign: Assigning: "new" =  storage returned from
                               "recode_malloc(outer, 16UL)".
src/request.c:768: leaked_storage: Variable "new" going out of scope
                                   leaks the storage it points to.

src/hash.c
src/html.c
src/request.c

index d8ba8d59b79c0cf69c2657b29e20db62ca17a73d..8f9e1e3f198743105ca035062d8cd62c2925a0be 100644 (file)
@@ -860,7 +860,10 @@ hash_rehash (Hash_table *table, size_t candidate)
                  struct hash_entry *new_entry = allocate_entry (new_table);
 
                  if (new_entry == NULL)
-                   return false;
+                   {
+                     hash_free (new_table);
+                     return false;
+                   }
 
                  new_entry->data = data;
                  new_entry->next = new_bucket->next;
index 2f4a3400ffa6bd26d3906d52f019b6ff5dd5af45..05e1fd53a090732e524191704a55402547a069a7 100644 (file)
@@ -435,7 +435,10 @@ init_ucs2_html (RECODE_STEP step,
     if (cursor->flags & mask
        && (!request->diacritics_only || cursor->code > 128))
       if (!hash_insert (table, cursor))
-       return false;
+       {
+         hash_free (table);
+         return false;
+       }
 
   step->step_type = RECODE_UCS2_TO_STRING;
   step->step_table = table;
@@ -616,7 +619,10 @@ init_html_ucs2 (RECODE_STEP step,
     if (cursor->flags & mask
        && (!request->diacritics_only || cursor->code > 128))
       if (!hash_insert (table, cursor))
-       return false;
+       {
+         hash_free (table);
+         return false;
+       }
 
   step->step_type = RECODE_STRING_TO_UCS2;
   step->step_table = table;
index 9964425115d8dedf3b4e85d60a11cb48c17487be..d1bbaafcacdf7d8433bfe77c3e5ec8ee97736cb7 100644 (file)
@@ -765,7 +765,10 @@ scan_options (RECODE_REQUEST request)
       scan_identifier (request);
       ALLOC (copy, strlen (request->scanned_string) + 1, char);
       if (!copy)
-       break;                  /* FIXME: should interrupt decoding */
+       {
+         free (new);
+         break;                /* FIXME: should interrupt decoding */
+       }
       strcpy (copy, request->scanned_string);
 
       new_->option = copy;