Download raw body.
check RB_INSERT() return value
On Thu, Apr 14, 2022 at 11:22:53AM +0200, Theo Buehler wrote: > This is independent of your diff, but op made me look: callers of > got_object_idset_add() also need to be careful to free the data they > passed in on error. I think you want something like this as well > (apologies for the git diff): Ok by me, thanks! > diff --git lib/pack_create.c lib/pack_create.c > index b52856ef..4e9a9b95 100644 > --- lib/pack_create.c > +++ lib/pack_create.c > @@ -867,11 +867,19 @@ add_object(int want_meta, struct got_object_idset *idset, > (*nfound)++; > err = report_progress(progress_cb, progress_arg, rl, > *ncolored, *nfound, *ntrees, 0L, 0, 0, 0, 0); > - if (err) > + if (err) { > + clear_meta(m); > + free(m); > return err; > + } > } > > - return got_object_idset_add(idset, id, m); > + err = got_object_idset_add(idset, id, m); > + if (err) { > + clear_meta(m); > + free(m); > + } > + return err; > } > > static const struct got_error * > diff --git lib/reference.c lib/reference.c > index ea1f566d..8616b4e5 100644 > --- lib/reference.c > +++ lib/reference.c > @@ -1569,8 +1569,10 @@ add_object_id_map_entry(struct got_object_idset *idset, > > TAILQ_INIT(&ent->refs); > err = got_object_idset_add(idset, id, ent); > - if (err) > + if (err) { > + free(ent); > return err; > + } > } > > err = got_reflist_entry_dup(&new, re); > >
check RB_INSERT() return value