summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/diff.c
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2008-01-29 12:00:34 +0000
committertobias <tobias@openbsd.org>2008-01-29 12:00:34 +0000
commit0c3e16f9d41def6e87b6b123f7b5fd8c9b1099d8 (patch)
tree26216550531ef20098ea0dae089cce694762035c /usr.bin/cvs/diff.c
parentProperly free dynamically allocated memory. Also skip needless checks. (diff)
downloadwireguard-openbsd-0c3e16f9d41def6e87b6b123f7b5fd8c9b1099d8.tar.xz
wireguard-openbsd-0c3e16f9d41def6e87b6b123f7b5fd8c9b1099d8.zip
Properly free dynamically allocated memory on error path.
> Diff from Igor Zinovik
Diffstat (limited to 'usr.bin/cvs/diff.c')
-rw-r--r--usr.bin/cvs/diff.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index 00392a367d3..dcbf6aa5b21 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.122 2008/01/28 20:31:07 tobias Exp $ */
+/* $OpenBSD: diff.c,v 1.123 2008/01/29 12:00:34 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -202,8 +202,11 @@ cvs_diff_local(struct cvs_file *cf)
return;
if (rev2 != NULL)
- if ((diff_rev2 = rcs_translate_tag(rev2, cf->file_rcs)) == NULL)
+ if ((diff_rev2 = rcs_translate_tag(rev2, cf->file_rcs)) ==
+ NULL) {
+ rcsnum_free(diff_rev1);
return;
+ }
diff_file = cf->file_path;
cvs_printf("Index: %s\n%s\nRCS file: %s\n", cf->file_path,