Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
libpkg: path can be NULL in first cleanup goto
Franco Fichtner committed 2 years ago
commit fc09e75e20a25e98f68f28f2e0ab0f6a8821b02d
parent 507aaa8
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);
	}