Michael Tokarev <m...@tls.msk.ru> writes: > 22.05.2014 18:57, Markus Armbruster wrote: > >> diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c >> index 692534c..f98541f 100644 >> --- a/libcacard/vcard_emul_nss.c >> +++ b/libcacard/vcard_emul_nss.c >> @@ -1178,11 +1178,7 @@ vcard_emul_options(const char *args) >> >> if (opts->vreader_count >= reader_count) { >> reader_count += READER_STEP; >> - vreaderOpt = realloc(opts->vreader, >> - reader_count * sizeof(*vreaderOpt)); >> - if (vreaderOpt == NULL) { >> - return opts; /* we're done */ >> - } >> + vreaderOpt = g_new(VirtualReaderOptions, reader_count); >> } >> opts->vreader = vreaderOpt; > > This does not look like equivalent code. It is equivalent > to malloc(), not realloc(). So we'll leak old opts->vreader > on every expansion of the array, and will lose old elements > in it too.
Typo, meant g_renew(), will respin. Thanks!