opkg: (leak fixing, day 1) lots and lots of memory leaks fixed
[oweals/opkg-lede.git] / libopkg / pkg_vec.c
index 294571f0f93dd634cc814ea5aa013159b8a14d75..72f9d7d366e083cd8f7e07db39917fbdedca12de 100644 (file)
@@ -1,4 +1,4 @@
-/* pkg_vec.c - the itsy package management system
+/* pkg_vec.c - the opkg package management system
 
    Steven M. Ayer
    
@@ -36,7 +36,12 @@ pkg_vec_t * pkg_vec_alloc(void)
 
 void pkg_vec_free(pkg_vec_t *vec)
 {
-    free(vec->pkgs);
+    if (!vec)
+      return;
+
+    if (vec->pkgs)
+      free(vec->pkgs);
+
     free(vec);
 }