summaryrefslogtreecommitdiffstats
path: root/src/benchmark.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-09-09 14:23:56 +0300
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-31 12:20:59 +0100
commitf23b74736458d2415dd1dfec0559af44e6353574 (patch)
treeed9911eb6e2f756eeb625d5825d02c5e43173104 /src/benchmark.c
parent750c896b4a9e619bbc6f712f82b8d602a1750f96 (diff)
libosmogapk: introduce the internal root talloc context
In order to simplify memory leak debugging, this change introduces the library's internal talloc context that may be changed by external application by calling the osmo_gapk_set_talloc_ctx().
Diffstat (limited to 'src/benchmark.c')
-rw-r--r--src/benchmark.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/benchmark.c b/src/benchmark.c
index c523f55..b3bb60b 100644
--- a/src/benchmark.c
+++ b/src/benchmark.c
@@ -23,6 +23,9 @@
#include <osmocom/gapk/benchmark.h>
#include <osmocom/gapk/codecs.h>
+/* Internal root talloc context */
+extern TALLOC_CTX *gapk_root_ctx;
+
struct osmo_gapk_bench_cycles *
osmo_gapk_bench_codec[_CODEC_MAX] = { NULL };
@@ -31,7 +34,7 @@ int osmo_gapk_bench_enable(enum osmo_gapk_codec_type codec)
struct osmo_gapk_bench_cycles *bench;
/* Allocate zero-initialized memory */
- bench = talloc_zero(NULL, struct osmo_gapk_bench_cycles);
+ bench = talloc_zero(gapk_root_ctx, struct osmo_gapk_bench_cycles);
if (!bench)
return -ENOMEM;