On Wed, Aug 30, 2023 at 2:21 PM Peter Krempa <pkre...@redhat.com> wrote:
> On Wed, Aug 30, 2023 at 13:59:21 +0200, Peter Krempa wrote: > > The 'buf', 'sa' and 'hints' stack allocated helper variables are never > > used together. Decrease the stack memory usage by scoping them off into > > do-while blocks. > > > > In this instance we do not want to use dynamic allocation as this is the > > NSS module. > > > > Signed-off-by: Peter Krempa <pkre...@redhat.com> > > --- > > tools/nss/libvirt_nss.c | 97 +++++++++++++++++++++++------------------ > > 1 file changed, 54 insertions(+), 43 deletions(-) > > > > diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c > > index 37720bf4ae..dff3c034bf 100644 > > --- a/tools/nss/libvirt_nss.c > > +++ b/tools/nss/libvirt_nss.c > > [...] > > > - hints = *pai; > > - hints.ai_flags = AI_NUMERICHOST; > > - hints.ai_family = af; > > + hints = *pai; > > + hints.ai_flags = AI_NUMERICHOST; > > + hints.ai_family = af; > > > > - if (getaddrinfo(host, NULL, &hints, &res0)) { > > - addrList++; > > - continue; > > Ehh, self-NACK ... Apart from moving these two continue into loops... > > > > - } > > + if (getaddrinfo(host, NULL, &hints, &res0)) { > > + addrList++; > > + continue; > > + } > > + } while (false); > > > > for (res = res0; res; res = res->ai_next) > > res->ai_flags = pai->ai_flags; > > -- > > 2.41.0 > > > > Reviewed-by: Kristina Hanicova <khani...@redhat.com> Kristina