Provide error checking for users of pkg_extract_* functions.
[oweals/opkg-lede.git] / libopkg / opkg_remove.c
index f744585a413edc51ce3d1f2dcb77712597fb2b93..f53ef00fbe40631d78e4ed4739f6d1d99ce5ef47 100644 (file)
@@ -329,8 +329,14 @@ remove_data_files_and_list(opkg_conf_t *conf, pkg_t *pkg)
      pkg_t *owner;
      int rootdirlen = 0;
 
-     str_list_init(&installed_dirs);
      installed_files = pkg_get_installed_files(conf, pkg);
+     if (installed_files == NULL) {
+            opkg_message(conf, OPKG_ERROR, "Failed to determine installed "
+                    "files for %s. None removed.\n", pkg->name);
+            return;
+     }
+
+     str_list_init(&installed_dirs);
 
      /* don't include trailing slash */
      if (conf->offline_root)