diff options
author | 2010-01-08 13:27:59 +0000 | |
---|---|---|
committer | 2010-01-08 13:27:59 +0000 | |
commit | 22b1adc4ae2437b51eaaa3f770d3fa79553d50f8 (patch) | |
tree | 62f9868404b1a2cea972513338b3c9e0dea4138d | |
parent | mouse-select-pane has to redraw the borders now too. (diff) | |
download | wireguard-openbsd-22b1adc4ae2437b51eaaa3f770d3fa79553d50f8.tar.xz wireguard-openbsd-22b1adc4ae2437b51eaaa3f770d3fa79553d50f8.zip |
Don't leak memory after strdup() in makedirs().
From Igor Zinovik; thanks!
ok stsp@, millert@
-rw-r--r-- | usr.bin/patch/util.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c index 8c3f888ae66..b27b57b62c3 100644 --- a/usr.bin/patch/util.c +++ b/usr.bin/patch/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.33 2009/10/27 23:59:41 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.34 2010/01/08 13:27:59 oga Exp $ */ /* * patch - a program to apply diffs to original files @@ -310,8 +310,10 @@ makedirs(const char *filename, bool striplast) if (striplast) { char *s = strrchr(tmpbuf, '/'); - if (s == NULL) + if (s == NULL) { + free(tmpbuf); return; /* nothing to be done */ + } *s = '\0'; } if (mkpath(tmpbuf) != 0) |