diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-09-23 17:59:04 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-09-23 17:59:04 +0000 |
commit | 9721f9b09481df645f1a9f3d1b3c47dc65c69fc9 (patch) | |
tree | 4f8c3b045e143d3e7c107f776de4586f7a69f304 /usr.bin/rcs/rcs.c | |
parent | e03491dcd4e6cca96bb5168c9e8ddb8e69576937 (diff) |
Plug memory leak in rcs_getrev, from zinovik.
ok me stsp
Diffstat (limited to 'usr.bin/rcs/rcs.c')
-rw-r--r-- | usr.bin/rcs/rcs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c index 76a93310228..ab377659142 100644 --- a/usr.bin/rcs/rcs.c +++ b/usr.bin/rcs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.63 2010/09/11 07:26:00 tobias Exp $ */ +/* $OpenBSD: rcs.c,v 1.64 2010/09/23 17:59:03 nicm Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -1207,8 +1207,10 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) if (RCSNUM_ISBRANCH(rev)) { brev = rev; rdp = rcs_findrev(rfp, rev); - if (rdp == NULL) + if (rdp == NULL) { + buf_free(rbuf); return (NULL); + } rev = rdp->rd_num; } else { @@ -1274,6 +1276,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) rcs_parse_deltatexts(rfp, rdp->rd_num); rbuf = rcs_patchfile(data, dlen, patch, plen, rcs_patch_lines); + xfree(data); if (rbuf == NULL) break; |