Re: [Outreachy PATCH v4 1/2] gpg-interface: do not use misdesigned strbuf_split*()
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Oct 21, 2025, 06:51 UTC
- Message-ID
- <CAP8UFD1=b9NN6stjnPR62Nu0qQmcC=bM2ZNQ=cO08PEwYoYAzA@mail.gmail.com>
- In-Reply-To
- <CAP8UFD1J_B9W62bv=0yccQNGahkv2vco3arQOs0oe0DccdTeYg@mail.gmail.com>
On Tue, Oct 21, 2025 at 8:46 AM Christian Couder <christian.couder@gmail.com> wrote:
Show 10 quoted lines
> > + delim = strchr(begin, ' ');
> > + if (!delim)
> > + die_errno(_("failed to get the ssh fingerprint for key %s"),
> > + signing_key);
> > + fingerprint_ret = xmemdupz(begin, delim - begin);
> > strbuf_release(&fingerprint_stdout);
> > return fingerprint_ret;
>
> I think this could be `return xmemdupz(begin, delim - begin);`, so we
> could get rid of `fingerprint_ret`.No, actually I think we need `fingerprint_ret` because we need to call `xmemdupz(begin, delim - begin)` before releasing `fingerprint_stdout`. Sorry for the noise.