diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2010-07-17 00:00:33 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2010-07-17 00:00:33 +0000 |
commit | f5bd122e9f5e9da2a49f0956e9c6a9329f21890d (patch) | |
tree | e43f4104733408b5941f4cfa363c7311a6a310be /usr.bin | |
parent | b3992efcc83913b329c6906e8923a525d3dbed1a (diff) |
Plug memory leak.
OK nicm
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/diff/diffdir.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/diff/diffdir.c b/usr.bin/diff/diffdir.c index 073b1fd0206..5105fbad96a 100644 --- a/usr.bin/diff/diffdir.c +++ b/usr.bin/diff/diffdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diffdir.c,v 1.36 2010/07/16 23:27:58 ray Exp $ */ +/* $OpenBSD: diffdir.c,v 1.37 2010/07/17 00:00:32 ray Exp $ */ /* * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> @@ -81,8 +81,9 @@ diffdir(char *p1, char *p2, int flags) /* get a list of the entries in each directory */ dp1 = dirp1 = slurpdir(path1, &dirbuf1, Nflag + Pflag); dp2 = dirp2 = slurpdir(path2, &dirbuf2, Nflag); - if (dirp1 == NULL || dirp2 == NULL) - return; + if (dirp1 == NULL || dirp2 == NULL) { + goto closem; + } /* * If we were given a starting point, find it. @@ -144,6 +145,7 @@ diffdir(char *p1, char *p2, int flags) } } +closem: if (dirbuf1 != NULL) { xfree(dirp1); xfree(dirbuf1); |