This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
It seems to me that freeing dataset is just wrong if it's allocated via mempool_alloc and things in mempool_alloc are GC'd.You've added a "free (dataset);" call, but DATASET is never malloc'd. If it's not alloca'd, it's from mempool_alloc.
I don't understand the nscd code well enough off hand to be sure it's appropriate to use mempool_alloc for whatever the "(he != NULL)" case means. If it is, then you don't need to free it because those pools are GC'd--so you need less change than you did, the 'alloca_used' variable is fine as it was. If it's not, then you need to use malloc for the new third case (he != NULL && !__libc_use_alloca (...)), handle that error case somehow, and do yet more bookkeeping to free it only when you used malloc.
if (he == NULL)
dataset = (struct dataset *) mempool_alloc (db, total + n, 1);
else if (! __libc_use_alloca (alloca_used + total + n))
dataset = (struct dataset *) malloc (...);| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |