From: Stefan Sperling Subject: Re: check got_pathlist_append() calls for error To: Mark Jamsek Cc: Game of Trees Date: Tue, 10 Jan 2023 14:07:53 +0100 On Tue, Jan 10, 2023 at 11:17:10PM +1100, Mark Jamsek wrote: > Catch a few missed got_pathlist_append() error checks in cmd_send() and > cmd_fetch(). ok > diff /home/mark/src/got > commit - fd20239feff11b69919be913807aa1f371b06fb9 > path + /home/mark/src/got > blob - 5e95ca3316302472e74abae334031fd6835220aa > file + got/got.c > --- got/got.c > +++ got/got.c > @@ -2483,14 +2483,18 @@ cmd_fetch(int argc, char *argv[]) > if (!fetch_all_branches) > fetch_all_branches = remote->fetch_all_branches; > for (i = 0; i < remote->nfetch_branches; i++) { > - got_pathlist_append(&wanted_branches, > + error = got_pathlist_append(&wanted_branches, > remote->fetch_branches[i], NULL); > + if (error) > + goto done; > } > } > if (TAILQ_EMPTY(&wanted_refs)) { > for (i = 0; i < remote->nfetch_refs; i++) { > - got_pathlist_append(&wanted_refs, > + error = got_pathlist_append(&wanted_refs, > remote->fetch_refs[i], NULL); > + if (error) > + goto done; > } > } > > @@ -9287,8 +9291,10 @@ cmd_send(int argc, char *argv[]) > } > } else if (nbranches == 0) { > for (i = 0; i < remote->nsend_branches; i++) { > - got_pathlist_append(&branches, > + error = got_pathlist_append(&branches, > remote->send_branches[i], NULL); > + if (error) > + goto done; > } > } > > > -- > Mark Jamsek > GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68