mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
do not use the sample samples objects in villas-hook as the hooks might add references to keep copies of older samples
This commit is contained in:
parent
e1813f5803
commit
7aa1c66d99
1 changed files with 6 additions and 4 deletions
10
src/hook.c
10
src/hook.c
|
@ -94,10 +94,6 @@ int main(int argc, char *argv[])
|
|||
if (ret)
|
||||
error("Failed to initilize memory pool");
|
||||
|
||||
ret = sample_alloc(&pool, samples, cnt);
|
||||
if (ret != cnt)
|
||||
error("Failed to allocate %u samples from pool", cnt);
|
||||
|
||||
h->parameter = parameter;
|
||||
|
||||
if (h->type & HOOK_INIT)
|
||||
|
@ -108,6 +104,10 @@ int main(int argc, char *argv[])
|
|||
h->cb(h, HOOK_PATH_START, &hi);
|
||||
|
||||
while (!feof(stdin)) {
|
||||
ret = sample_alloc(&pool, samples, cnt);
|
||||
if (ret != cnt)
|
||||
error("Failed to allocate %u samples from pool", cnt);
|
||||
|
||||
for (j = 0; j < cnt && !feof(stdin); j++)
|
||||
sample_fscan(stdin, hi.smps[j], NULL);
|
||||
|
||||
|
@ -122,6 +122,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
for (j = 0; j < hi.cnt; j++)
|
||||
sample_fprint(stdout, hi.smps[j], SAMPLE_ALL);
|
||||
|
||||
sample_free(samples, cnt);
|
||||
}
|
||||
|
||||
if (h->type & HOOK_PATH_STOP)
|
||||
|
|
Loading…
Add table
Reference in a new issue