summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/tpax_driver_ctx.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c
index 0a92537..c621bb6 100644
--- a/src/driver/tpax_driver_ctx.c
+++ b/src/driver/tpax_driver_ctx.c
@@ -276,6 +276,12 @@ static struct tpax_driver_ctx_impl * tpax_driver_ctx_alloc(
ictx->ctx.errinfp = &ictx->ctx.erriptr[0];
ictx->ctx.erricap = &ictx->ctx.erriptr[--elements];
+ elements = sizeof(ictx->ctx.prefptr) / sizeof(*ictx->ctx.prefptr);
+
+ ictx->ctx.prefixv = &ictx->ctx.prefptr[0];
+ ictx->ctx.prefixp = &ictx->ctx.prefptr[0];
+ ictx->ctx.prefcap = &ictx->ctx.prefptr[--elements];
+
ictx->meta = meta;
for (entry=meta->entries,units=ictx->units; entry->fopt || entry->arg; entry++)
@@ -561,6 +567,7 @@ static void tpax_free_driver_ctx_impl(struct tpax_driver_ctx_alloc * ictx)
{
void * next;
size_t size;
+ char ** ppref;
for (; ictx->ctx.dirents; ) {
next = ictx->ctx.dirents->next;
@@ -576,6 +583,12 @@ static void tpax_free_driver_ctx_impl(struct tpax_driver_ctx_alloc * ictx)
if (ictx->ctx.dirbuff)
munmap(ictx->ctx.dirbuff,TPAX_DIRENT_BUFLEN);
+ for (ppref=ictx->ctx.prefixv; *ppref; ppref++)
+ free(*ppref);
+
+ if (ictx->ctx.prefixv != ictx->ctx.prefptr)
+ free(ictx->ctx.prefixv);
+
argv_free(ictx->meta);
free(ictx);
}