* [PATCH] delete_ref(): fix uninitialized value, found by valgrind
[not found] <cover.1233684745u.git.johannes.schindelin@gmx.de>
@ 2009-02-03 18:12 ` Johannes Schindelin
2009-02-04 6:00 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2009-02-03 18:12 UTC (permalink / raw)
To: git; +Cc: gitster
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);
--
1.6.1.2.574.g140d5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] delete_ref(): fix uninitialized value, found by valgrind
2009-02-03 18:12 ` [PATCH] delete_ref(): fix uninitialized value, found by valgrind Johannes Schindelin
@ 2009-02-04 6:00 ` Junio C Hamano
2009-02-04 9:57 ` Johannes Schindelin
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2009-02-04 6:00 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] delete_ref(): fix uninitialized value, found by valgrind
2009-02-04 6:00 ` Junio C Hamano
@ 2009-02-04 9:57 ` Johannes Schindelin
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2009-02-04 9:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Hi,
On Tue, 3 Feb 2009, Junio C Hamano wrote:
> 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.
I should know better by now than to base my work on the tip of my Git
tree. Sure enough I have an attempt at resolving the "deleting a branch
deletes its reflog, too" issue, which has that bug.
Sorry for the noise,
Dscho
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-02-04 9:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
2009-02-04 9:57 ` Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox