mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-21 10:29:02 +00:00
frees: sample
This commit is contained in:
parent
d76fb176e1
commit
225fe2abd2
1 changed files with 6 additions and 0 deletions
|
|
@ -94,6 +94,11 @@ static void mapper_sample_free(void* pvstate) {
|
|||
mapper_sample_state_t* pstate = pvstate;
|
||||
if (pstate->pgroup_by_field_names != NULL)
|
||||
slls_free(pstate->pgroup_by_field_names);
|
||||
// lhmslv_free will free the hashmap keys; we need to free the void-star hashmap values.
|
||||
for (lhmslve_t* pa = pstate->pbuckets_by_group->phead; pa != NULL; pa = pa->pnext) {
|
||||
sample_bucket_t* pbucket = pa->pvvalue;
|
||||
sample_bucket_free(pbucket);
|
||||
}
|
||||
|
||||
// xxx free the void-star payloads 1st
|
||||
lhmslv_free(pstate->pbuckets_by_group);
|
||||
|
|
@ -122,6 +127,7 @@ static sllv_t* mapper_sample_process(lrec_t* pinrec, context_t* pctx, void* pvst
|
|||
sample_bucket_t* pbucket = pa->pvvalue;
|
||||
for (int i = 0; i < pbucket->nused; i++) {
|
||||
sllv_add(poutrecs, pbucket->plrecs[i]);
|
||||
pbucket->plrecs[i] = NULL;
|
||||
}
|
||||
pbucket->nused = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue