summaryrefslogtreecommitdiff
path: root/usr.bin/rcs/rcs.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2010-10-20 19:55:47 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2010-10-20 19:55:47 +0000
commitff7e6f54b830149eadaad0206fc48966ba3f8a63 (patch)
tree0c4b7fc60f2f676a1026e798b318e64174f96fd9 /usr.bin/rcs/rcs.c
parent4bb524a26cf8dbc3f4e455b25d68b291c57a5466 (diff)
Merge OpenCVS' rcs_deltatext_set into OpenRCS, fixing a memory leak.
ok nicm zinovik
Diffstat (limited to 'usr.bin/rcs/rcs.c')
-rw-r--r--usr.bin/rcs/rcs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index 1d58cb5cdc2..d154eaa7ead 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.69 2010/10/20 19:53:53 tobias Exp $ */
+/* $OpenBSD: rcs.c,v 1.70 2010/10/20 19:55:46 tobias Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1897,12 +1897,14 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM *rev, BUF *bp)
rdp->rd_text = xmalloc(len);
rdp->rd_tlen = len;
(void)memcpy(rdp->rd_text, dtext, len);
- xfree(dtext);
} else {
rdp->rd_text = NULL;
rdp->rd_tlen = 0;
}
+ if (dtext != NULL)
+ xfree(dtext);
+
return (0);
}