On 09/17/14 14:15, Michal Privoznik wrote: > diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c > index 0c4b09f..8543963 100644 > --- a/tests/domaincapstest.c > +++ b/tests/domaincapstest.c > @@ -34,6 +34,27 @@ typedef int (*virDomainCapsFill)(virDomainCapsPtr domCaps, > #define SET_ALL_BITS(x) \ > memset(&(x.values), 0xff, sizeof(x.values)) > > +static int ATTRIBUTE_SENTINEL > +fillStringValues(virDomainCapsStringValuesPtr values, ...) > +{ > + int ret = 0; > + va_list list; > + const char *str; > + > + va_start(list, values); > + while ((str = va_arg(list, const char *))) { > + if (VIR_REALLOC_N(values->values, values->nvalues + 1) < 0 || > + VIR_STRDUP(values->values[values->nvalues], str) < 0) { > + ret = -1; > + break; > + } > + values->nvalues++; > + } > + va_end(list); > + > + return ret; > +} Okay, you increment "values->nvalues" only after. The rest too looks good to me. Acked-by: Laszlo Ersek <lersek@xxxxxxxxxx> Thanks Laszlo -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list