summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2007-01-13 16:03:54 +0000
committerJoris Vink <joris@cvs.openbsd.org>2007-01-13 16:03:54 +0000
commitcdb41e7f72c52c2195442a01dd3f602b79f845d4 (patch)
tree9bcc3f4d97f758150494899b6bb05fd048ef5bf4 /usr.bin/cvs
parentc517fd2b7e7a999171d1b05c64db453ddd904ce6 (diff)
make a copy of cf->file_ent->ce_rev in cf->file_rcsrev when needed
otherwise we might get a NULL dereference when free'ing the cf struct with cvs_file_free()
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index d6f18c34c46..b44092a55e9 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.168 2007/01/12 23:32:01 niallo Exp $ */
+/* $OpenBSD: file.c,v 1.169 2007/01/13 16:03:53 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -642,9 +642,10 @@ cvs_file_classify(struct cvs_file *cf, const char *tag, int loud)
if (tag != NULL && cf->file_rcs != NULL)
cf->file_rcsrev = rcs_translate_tag(tag, cf->file_rcs);
- else if (cf->file_ent != NULL && cf->file_ent->ce_tag != NULL)
- cf->file_rcsrev = cf->file_ent->ce_rev;
- else if (cf->file_rcs != NULL)
+ else if (cf->file_ent != NULL && cf->file_ent->ce_tag != NULL) {
+ cf->file_rcsrev = rcsnum_alloc();
+ rcsnum_cpy(cf->file_ent->ce_rev, cf->file_rcsrev, 0);
+ } else if (cf->file_rcs != NULL)
cf->file_rcsrev = rcs_head_get(cf->file_rcs);
else
cf->file_rcsrev = NULL;