s/strdup/xstrdup/ - check memory allocations for failure.
[oweals/opkg-lede.git] / libopkg / hash_table.c
index 713ecff605889eb349222319a9087002da5b7cdd..6de90856d8694ccf06aec96890f4f62e5d88d4b7 100644 (file)
@@ -21,6 +21,7 @@
 #include <string.h>
 #include "hash_table.h"
 #include "opkg_message.h"
+#include "libbb/libbb.h"
 
 
 static int hash_index(hash_table_t *hash, const char *pkg_name);
@@ -155,7 +156,7 @@ int hash_table_insert(hash_table_t *hash, const char *key, void *value)
          }
      }
      hash->n_elements++;
-     hash_entry->key = strdup(key);
+     hash_entry->key = xstrdup(key);
      hash_entry->data = value;
 
      return 0;