Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkg/clean.c: ensure calling pkgdb_it_free() when needed.
Alexandre Perrin committed 12 years ago
commit c229a8d3eb992a59218c56f2a4370191414d7b29
parent 5afa54a
1 file changed +11 -0
modified pkg/clean.c
@@ -321,6 +321,10 @@ exec_clean(int argc, char **argv)
		if (all) {
			ret = add_to_dellist(&dl, ALL, ent->fts_path,
					     origin, NULL, NULL);
+
			/*
+
			 * FIXME: `ret' is not checked, what should be done if
+
			 * add_to_dellist() fails ?
+
			 */
			pkgdb_it_free(it);
			continue;
		}
@@ -329,6 +333,7 @@ exec_clean(int argc, char **argv)
		if (ret == EPKG_FATAL) {
			if (!quiet)
				warnx("skipping %s", ent->fts_path);
+
			pkgdb_it_free(it);
			continue;
		}

@@ -336,6 +341,11 @@ exec_clean(int argc, char **argv)
			/* No matching package found in repo */
			ret = add_to_dellist(&dl, REMOVED, ent->fts_path,
					     origin, NULL, NULL);
+
			/*
+
			 * FIXME: `ret' is not checked, what should be done if
+
			 * add_to_dellist() fails ?
+
			 */
+
			pkgdb_it_free(it);
			continue;
		}

@@ -372,6 +382,7 @@ exec_clean(int argc, char **argv)

		if (ret != EPKG_OK && ret != EPKG_END) {
			retcode = EX_OSERR; /* out of memory */
+
			pkgdb_it_free(it);
			goto cleanup;
		}