Download raw body.
plug a few small leaks in tog and repository.c:match_packed_object()
plug a few small leaks in tog and repository.c:match_packed_object()
plug a few small leaks in tog and repository.c:match_packed_object()
plug a few small leaks in tog and repository.c:match_packed_object()
On Thu, Dec 21, 2023 at 08:48:23AM +0100, Omar Polo wrote:
> On 2023/12/21 17:32:33 +1100, Mark Jamsek <mark@jamsek.com> wrote:
> > I think op's suggestion to ditch f entirely and just use s->f fixes
> > this? I'm not even sure why I was using the temporary tbh.
>
> ok op@
>
> Thanks!
ok by me, too.
> > diff 85467924748b0e27f0105bde280878a149df9fc8 15c9072be9bc5952579bbb8a3cad7e12c9f3a009
> > commit - 85467924748b0e27f0105bde280878a149df9fc8
> > commit + 15c9072be9bc5952579bbb8a3cad7e12c9f3a009
> > blob - be366266e526e26c8734719d20d29ed05d463b06
> > blob + 1d2d2883f6f459ee2e81334d5953c0559d5de275
> > --- tog/tog.c
> > +++ tog/tog.c
> > @@ -5304,7 +5304,7 @@ static const struct got_error *
> > create_diff(struct tog_diff_view_state *s)
> > {
> > const struct got_error *err = NULL;
> > - FILE *f = NULL, *tmp_diff_file = NULL;
> > + FILE *tmp_diff_file = NULL;
> > int obj_type;
> > struct got_diff_line *lines = NULL;
> > struct got_pathlist_head changed_paths;
> > @@ -5318,22 +5318,19 @@ create_diff(struct tog_diff_view_state *s)
> > return got_error_from_errno("malloc");
> > s->nlines = 0;
> >
> > - f = got_opentemp();
> > - if (f == NULL) {
> > - err = got_error_from_errno("got_opentemp");
> > - goto done;
> > - }
> > - tmp_diff_file = got_opentemp();
> > - if (tmp_diff_file == NULL) {
> > - err = got_error_from_errno("got_opentemp");
> > - goto done;
> > - }
> > if (s->f && fclose(s->f) == EOF) {
> > - err = got_error_from_errno("fclose");
> > - goto done;
> > + s->f = NULL;
> > + return got_error_from_errno("fclose");
> > }
> > - s->f = f;
> >
> > + s->f = got_opentemp();
> > + if (s->f == NULL)
> > + return got_error_from_errno("got_opentemp");
> > +
> > + tmp_diff_file = got_opentemp();
> > + if (tmp_diff_file == NULL)
> > + return got_error_from_errno("got_opentemp");
> > +
> > if (s->id1)
> > err = got_object_get_type(&obj_type, s->repo, s->id1);
> > else
>
>
>
plug a few small leaks in tog and repository.c:match_packed_object()
plug a few small leaks in tog and repository.c:match_packed_object()
plug a few small leaks in tog and repository.c:match_packed_object()
plug a few small leaks in tog and repository.c:match_packed_object()