coreutils

General Software Utilities
git clone http://git.omkov.net/coreutils
Log | Tree | Refs | README | LICENCE | Download

AuthorJamozed <[email protected]>
Date2020-11-12 11:11:41
Commitbcc3fa8913bea92f3d2a168c0523ada66e1853ec
Parent4de09c8a5c136d4d0dc7108852e788dfe656bbbe

mkdir: Fix mode array memory leak

Diffstat

M src/mkdir.c | 3 ++-

1 files changed, 2 insertions, 1 deletions

diff --git a/src/mkdir.c b/src/mkdir.c
index 006da0e..a29dd45 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -44,6 +44,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 #include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #define VERSION "1.0.4"
 
@@ -97,7 +98,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 		if (makedir(*p, m)) { warn("%s: %s", *p, serr()); warned = true; }
 	}
 
-	return warned;
+	if (m) { free(m); } return warned;
 }
 
 /* Make directory with specified permissions */