Download raw body.
gotweb: return error instead of NULL
On Fri, May 29, 2020 at 01:49:42PM +0200, Martin Vahlensieck wrote:
> Hi
>
> It looks wrong to return NULL here. First error is set and not used, and
> second *gw_dir (which is set to NULL) is dereferenced by the next
> function without checking for NULL.
>
> Best,
>
> Martin
>
> diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
> index ecbcccb4..1bfc5141 100644
> --- a/gotweb/gotweb.c
> +++ b/gotweb/gotweb.c
> @@ -2099,7 +2099,7 @@ gw_init_gw_dir(struct gw_dir **gw_dir, const char *dir)
> error = got_error_from_errno("asprintf");
> free(*gw_dir);
> *gw_dir = NULL;
> - return NULL;
> + return error;
Yes, this is correct.
Thank you.
> }
>
> return NULL;
--
Tracey Emery
gotweb: return error instead of NULL