Re: [PATCH] submodule-config: use explicit empty string instead of strbuf in config_from()
- From
Heiko Voigt <hvoigt@hvoigt.net>
- Date
- Jul 25, 2016, 14:37 UTC
- Message-ID
- <20160725143706.GA4872@sandbox>
- In-Reply-To
- <57911AFF.7030107@web.de>
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
[...]
Show 25 quoted lines
> >@@ -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