From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] delete_ref(): fix uninitialized value, found by valgrind
Date: Tue, 03 Feb 2009 22:00:14 -0800 [thread overview]
Message-ID: <7v7i467ndd.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.DEB.1.00.0902031912290.9822@pacific.mpi-cbg.de> (Johannes Schindelin's message of "Tue, 3 Feb 2009 19:12:40 +0100 (CET)")
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> The variable 'err' was not necessarily initialized before it was used.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> refs.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index b13e01b..ded7ec4 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -929,7 +929,7 @@ static int log_ref_write(const char *ref_name, const unsigned char *old_sha1,
> int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
> {
> struct ref_lock *lock;
> - int err, i = 0, ret = 0, flag = 0;
> + int err = 0, i = 0, ret = 0, flag = 0;
> struct stat loginfo;
> int log = !lstat(git_path("logs/%s", refname), &loginfo);
Sorry, I do not see it.
There are two uses of "err" in this function, both of which looks like:
if (err && errno != ENOENT)
but both of these places have
err = unlink(...)
immediately before it.
next prev parent reply other threads:[~2009-02-04 6:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1233684745u.git.johannes.schindelin@gmx.de>
2009-02-03 18:12 ` [PATCH] delete_ref(): fix uninitialized value, found by valgrind Johannes Schindelin
2009-02-04 6:00 ` Junio C Hamano [this message]
2009-02-04 9:57 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v7i467ndd.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox