diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2009-03-22 18:40:56 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2009-03-22 18:40:56 +0000 |
commit | 1a9b60bb71ed6adc4a29f0289dd873561befb793 (patch) | |
tree | a8c2344ac20fa7530a41519fa3fddddf0f841423 | |
parent | cc886d2e2051533cd794a9578220d75b44de4487 (diff) |
Avoid the usage of uninitialized value, which even might result in a memory
leak if a file has no line in CVS/Entries.
ok joris
-rw-r--r-- | usr.bin/cvs/tag.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/cvs/tag.c b/usr.bin/cvs/tag.c index 085571c3dba..747abfcf764 100644 --- a/usr.bin/cvs/tag.c +++ b/usr.bin/cvs/tag.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tag.c,v 1.76 2008/06/20 14:04:29 tobias Exp $ */ +/* $OpenBSD: tag.c,v 1.77 2009/03/22 18:40:55 tobias Exp $ */ /* * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> * @@ -260,9 +260,6 @@ cvs_tag_check_files(struct cvs_file *cf) break; } - fi = xcalloc(1, sizeof(*fi)); - fi->nrevstr = xstrdup(rbuf); - if (cvs_cmdop == CVS_OP_TAG) { if (cf->file_ent == NULL) return; @@ -271,6 +268,8 @@ cvs_tag_check_files(struct cvs_file *cf) srev = cf->file_rcsrev; rcsnum_tostr(srev, rbuf, sizeof(rbuf)); + fi = xcalloc(1, sizeof(*fi)); + fi->nrevstr = xstrdup(rbuf); fi->file_path = xstrdup(cf->file_path); if (tag_oldname != NULL) |