diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-06-08 03:03:09 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-06-08 03:03:09 +0000 |
commit | d55333f7c0e0be12e82f8eaa70215e6aa9b421d4 (patch) | |
tree | 738dbb6e46a3d8a312e5b1181ff516d319d2c7f9 /usr.bin/cvs | |
parent | a0031e7262615243bcec56ae05c88258995a20e5 (diff) |
Avoid memory leaks in directory tag handling by always allocating and
always freeing dirtag.
ok joris
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/checkout.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 15 |
2 files changed, 12 insertions, 7 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c index 202c508c7e4..abcaf193522 100644 --- a/usr.bin/cvs/checkout.c +++ b/usr.bin/cvs/checkout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: checkout.c,v 1.144 2008/05/22 15:45:01 tobias Exp $ */ +/* $OpenBSD: checkout.c,v 1.145 2008/06/08 03:03:07 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -269,8 +269,6 @@ checkout_check_repository(int argc, char **argv) return; } - cvs_directory_tag = cvs_specified_tag; - for (i = 0; i < argc; i++) { mc = cvs_module_lookup(argv[i]); current_module = mc; diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index 9457f9aa2fb..4f97b08a454 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.238 2008/06/08 02:52:24 tobias Exp $ */ +/* $OpenBSD: file.c,v 1.239 2008/06/08 03:03:08 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -341,7 +341,8 @@ cvs_file_walklist(struct cvs_flisthead *fl, struct cvs_recursion *cr) if (cvs_directory_tag == NULL && cvs_specified_tag != NULL) - cvs_directory_tag = cvs_specified_tag; + cvs_directory_tag = + xstrdup(cvs_specified_tag); if (current_cvsroot->cr_method == CVS_METHOD_LOCAL) { @@ -355,8 +356,14 @@ cvs_file_walklist(struct cvs_flisthead *fl, struct cvs_recursion *cr) if (cr->fileproc != NULL) cr->fileproc(cf); - if (l->user_supplied && cmdp->cmd_flags & CVS_LOCK_REPO) - cvs_repository_unlock(repo); + if (l->user_supplied) { + if (cmdp->cmd_flags & CVS_LOCK_REPO) + cvs_repository_unlock(repo); + if (cvs_directory_tag != NULL) { + xfree(cvs_directory_tag); + cvs_directory_tag = NULL; + } + } } cvs_file_free(cf); |