Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix a nice leak in 'install' and 'delete'
Marin Atanasov Nikolov committed 14 years ago
commit 78f5ac853a06ba760e8e7c3d1c4550a9e96a7b53
parent 768aeb2
2 files changed +9 -5
modified pkg/delete.c
@@ -90,6 +90,8 @@ exec_delete(int argc, char **argv)
			pkg_jobs_add(jobs, pkg);
			pkg = NULL;
		}
+

+
		pkgdb_it_free(it);
	} else {
		for (i = 0; i < argc; i++) {
			if ((it = pkgdb_query(db, argv[i], match)) == NULL) {
@@ -101,6 +103,8 @@ exec_delete(int argc, char **argv)
				pkg_jobs_add(jobs, pkg);
				pkg = NULL;
			}
+
		
+
			pkgdb_it_free(it);
		}
	}

@@ -127,7 +131,6 @@ exec_delete(int argc, char **argv)
	retcode = pkgdb_compact(db);

	cleanup:
-
	pkgdb_it_free(it);
	pkgdb_close(db);
	pkg_jobs_free(jobs);

modified pkg/install.c
@@ -16,7 +16,7 @@
void
usage_install(void)
{
-
	fprintf(stderr, "usage: pkg install [-ygxXf] <pkg-name> <...>\n");
+
	fprintf(stderr, "usage: pkg install [-ygxXf] <pkg-name> <...>\n\n");
	fprintf(stderr, "For more information see 'pkg help install'.\n");
}

@@ -81,7 +81,10 @@ exec_install(int argc, char **argv)
		while (( retcode = pkgdb_it_next(it, &pkg, PKG_LOAD_BASIC)) == EPKG_OK) {
			pkg_jobs_add(jobs, pkgdb_query_remote(db, pkg_get(pkg, PKG_ORIGIN)));
		}
-

+
		
+
		pkg_free(pkg);
+
		pkg = NULL;
+
		pkgdb_it_free(it);
	}

	/* print a summary before applying the jobs */
@@ -100,8 +103,6 @@ exec_install(int argc, char **argv)
	cleanup:
	
	pkg_jobs_free(jobs);
-
	pkgdb_it_free(it);
-
	pkg_free(pkg);
	pkgdb_close(db);

	return (retcode == EPKG_OK ? EX_OK : 1);