diff options
author | 2009-03-22 18:40:55 +0000 | |
---|---|---|
committer | 2009-03-22 18:40:55 +0000 | |
commit | 77f7cc85f5429f80f9ff924ccadf0aa9e6ad52ca (patch) | |
tree | 263a469d56fd7a0fd0a25e78646becb759be2dd9 | |
parent | Properly free allocated memory in error case. (diff) | |
download | wireguard-openbsd-77f7cc85f5429f80f9ff924ccadf0aa9e6ad52ca.tar.xz wireguard-openbsd-77f7cc85f5429f80f9ff924ccadf0aa9e6ad52ca.zip |
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) |