Subject: Re: [PATCH] submodule-config: use explicit empty string instead of strbuf in config_from()

From: Heiko Voigt <[email-masked]>
Date: Mon, 25 Jul 2016 16:37:07 +0200

Hi,

On Thu, Jul 21, 2016 at 08:57:03PM +0200, René Scharfe wrote:
> >diff --git a/submodule-config.c b/submodule-config.c
> >index 077db40..dccea59 100644
> >--- a/submodule-config.c
> >+++ b/submodule-config.c

[...]

> >@@ -431,14 +432,19 @@ static const struct submodule *config_from(struct submodule_cache *cache,
> >  		submodule = cache_lookup_path(cache, sha1, key);
> >  		break;
> >  	}
> >-	if (submodule)
> >+	if (submodule) {
> >+		strbuf_release(&rev);
> >  		return submodule;
> >+	}
> >
> >  	config = read_sha1_file(sha1, &type, &config_size);
> >-	if (!config)
> >+	if (!config) {
> >+		strbuf_release(&rev);
> >  		return NULL;
> >+	}
> >
> >  	if (type != OBJ_BLOB) {
> >+		strbuf_release(&rev);
> >  		free(config);
> >  		return NULL;
> >  	}
> 
> A separate patch could combine the previous two conditionals; free(NULL) is
> allowed.

Thats a good idea. Can send a patch, but I noticed that your change is
already in next and my change has not been picked up. So I am unsure if
I should base my patches on next or if Junio wants to keep your change?

Cheers Heiko