Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
libpkg/pkg_macho.c: avoid calling free() and instead just return the error value
rilysh committed 2 years ago
commit 377187bf82a47c5e79f3dbf956d03a061b1d8ec3
parent 16e27d4
1 file changed +2 -3
modified libpkg/pkg_macho.c
@@ -385,11 +385,11 @@ pkg_get_myarch(char *dest, size_t sz, struct os_info *__unused u)

	/* Fetch basic OS info */
	if ((ret = host_os_info(os_name, sizeof(os_name), &major_version)) != EPKG_OK)
-
		goto cleanup;
+
	        return ret;

	/* Fetch host CPU type */
	if ((ret = host_cpu_type(&cpu_type)) != EPKG_OK)
-
		goto cleanup;
+
	        return ret;

	/* Fetch the name for the base CPU family */
	cpu_name = macho_get_arch_name(cpu_type);
@@ -398,7 +398,6 @@ pkg_get_myarch(char *dest, size_t sz, struct os_info *__unused u)
	xasprintf(&spec, "%s:%lld:%s", os_name, major_version, cpu_name);
	strlcpy(dest, spec, sz);

-
cleanup:
	free(spec);
	return ret;
}