upstream: Fix memory leak on an error path in mkdir_path

CID 913589

OK djm@

OpenBSD-Commit-ID: 0050b75ec87722e115d33a3d181a3c24175079e5
This commit is contained in:
job@openbsd.org authored and Damien Miller committed 2026-09-15 18:30:38 +10:00
1 parent 805388d59d
commit 961cc92164
1 file changed
+2 -1
+2 -1
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: misc.c,v 1.216 2026/09/07 20:24:22 job Exp $ */
/* $OpenBSD: misc.c,v 1.217 2026/09/15 08:26:49 job Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
@@ -3239,6 +3239,7 @@ mkdir_path(const char *target, mode_t mode)
if (*dir == '/' &&
(fd = open("/", O_RDONLY|O_DIRECTORY)) == -1) {
error_f("open(\"/\"): %s", strerror(errno));
free(odir);
return -1;
}
/* Work through the path, component-wise */