Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
libpkg: path can be NULL in first cleanup goto
Franco Fichtner committed 2 years ago
commit fc09e75e20a25e98f68f28f2e0ab0f6a8821b02d
parent 507aaa80158b81a9065a978cb0b52820e89db722
1 file changed +5 -5
modified libpkg/repo/binary/update.c
@@ -562,12 +562,12 @@ cleanup:
		if (pkgdb_transaction_commit_sqlite(sqlite, "REPO") != EPKG_OK)
			rc = EPKG_FATAL;
	}
-
	/* restore the previous db in case of failures */
-
	if (rc != EPKG_OK && rc != EPKG_UPTODATE) {
-
		unlink(name);
-
		rename(path, name);
-
	}
	if (path != NULL) {
+
		/* restore the previous db in case of failures */
+
		if (rc != EPKG_OK && rc != EPKG_UPTODATE) {
+
			unlink(name);
+
			rename(path, name);
+
		}
		unlink(path);
		free(path);
	}