From 570941ffa9414ff20430dd9d1e09a03489dad2ce Mon Sep 17 00:00:00 2001 From: joris Date: Fri, 12 Jan 2007 19:28:12 +0000 Subject: do not leak memory from rcs_head_get() ok niallo@ --- usr.bin/cvs/commit.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'usr.bin/cvs/commit.c') diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index afd19bb8b66..28cec83e6b3 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.92 2007/01/12 18:27:18 joris Exp $ */ +/* $OpenBSD: commit.c,v 1.93 2007/01/12 19:28:12 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink * Copyright (c) 2006 Xavier Santolaria @@ -205,6 +205,7 @@ cvs_commit_local(struct cvs_file *cf) { BUF *b, *d; int isnew; + RCSNUM *head; int l, openflags, rcsflags; char rbuf[24], nbuf[24]; CVSENTRIES *entlist; @@ -221,10 +222,13 @@ cvs_commit_local(struct cvs_file *cf) if (cf->file_status == FILE_MODIFIED || cf->file_status == FILE_REMOVED || (cf->file_status == FILE_ADDED - && cf->file_rcs != NULL && cf->file_rcs->rf_dead == 1)) - rcsnum_tostr(rcs_head_get(cf->file_rcs), rbuf, sizeof(rbuf)); - else + && cf->file_rcs != NULL && cf->file_rcs->rf_dead == 1)) { + head = rcs_head_get(cf->file_rcs); + rcsnum_tostr(head, rbuf, sizeof(rbuf)); + rcsnum_free(head); + } else { strlcpy(rbuf, "Non-existent", sizeof(rbuf)); + } isnew = 0; if (cf->file_status == FILE_ADDED) { -- cgit v1.2.3-59-g8ed1b