opkg: adding the hash_table_remove API, not using yet.
[oweals/opkg-lede.git] / libopkg / opkg.c
index 7e6775552607a871cb971a5fbb147573d2adabb1..35ddb89bcebee341774dc75aac8cce4e67e409cc 100644 (file)
@@ -163,8 +163,7 @@ opkg_package_new ()
 
   opkg_package_t *p;
 
-  p = malloc (sizeof (opkg_package_t));
-  memset (p, 0, sizeof (opkg_package_t));
+  p = calloc (1, sizeof (opkg_package_t));
 
   return p;
 }
@@ -189,9 +188,9 @@ opkg_new ()
   opkg_t *opkg;
   int err;
 
-  opkg = malloc (sizeof (opkg_t));
+  opkg = calloc (1, sizeof (opkg_t));
 
-  opkg->args = malloc (sizeof (args_t));
+  opkg->args = calloc (1, sizeof (args_t));
   err = args_init (opkg->args);
   if (err)
   {
@@ -200,7 +199,7 @@ opkg_new ()
     return NULL;
   }
 
-  opkg->conf = malloc (sizeof (opkg_conf_t));
+  opkg->conf = calloc (1, sizeof (opkg_conf_t));
   err = opkg_conf_init (opkg->conf, opkg->args);
   if (err)
   {