diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-01-08 13:28:00 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-01-08 13:28:00 +0000 |
commit | dc3742241db030c12758ee459d345f2da733c7fa (patch) | |
tree | 323adb49041da959829ca5676fbc007689eff81c /usr.bin/patch/util.c | |
parent | f8a55a5cb27bf62ce22fd7a9f6598e0301cd4525 (diff) |
Don't leak memory after strdup() in makedirs().
From Igor Zinovik; thanks!
ok stsp@, millert@
Diffstat (limited to 'usr.bin/patch/util.c')
-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) |