using hash_table reduce an O(n^2) algorithm to O(n)
[oweals/opkg-lede.git] / libopkg / file_util.c
index da8a1cda0ed583a0cd5d8a91fb41aa9da6aa2805..fad4178901f8f9aa47961d2131acfeaa27501830 100644 (file)
@@ -15,7 +15,7 @@
    General Public License for more details.
 */
 
-#include "opkg.h"
+#include "includes.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -140,10 +140,10 @@ char *file_md5sum_alloc(const char *file_name)
 
     int i, err;
     FILE *file;
-    unsigned char *md5sum_hex;
+    char *md5sum_hex;
     unsigned char md5sum_bin[md5sum_bin_len];
 
-    md5sum_hex = malloc(md5sum_hex_len + 1);
+    md5sum_hex = calloc(1, md5sum_hex_len + 1);
     if (md5sum_hex == NULL) {
        fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
        return strdup("");