]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
build: make Python memory allocations valgrind friendly
authorDaniel Wagner <dwagner@suse.de>
Fri, 11 Feb 2022 12:45:57 +0000 (13:45 +0100)
committerDaniel Wagner <dwagner@suse.de>
Fri, 11 Feb 2022 12:45:57 +0000 (13:45 +0100)
When testing with

  meson test -C .build --wrap='valgrind --leak-check=full'

the Python binding will trigger 'Invalid read of size 4' warnings.
Tell Python to use malloc directly for all memory allocation which can
be properly traced by valgrind.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
libnvme/meson.build

index e077fe68d258a7d29e7971397fef5692622987ba..cfed0e2ac86e0e3382d8659d4176afe3ac928145 100644 (file)
@@ -55,6 +55,7 @@ if have_python_support
     test_env = environment()
     test_env.append('MALLOC_PERTURB_', '0')
     test_env.append('PYTHONPATH', join_paths(meson.current_build_dir(), '..'))
+    test_env.append('PYTHONMALLOC', 'malloc')
 
     # Test section
     test('[Python] import libnvme', python3, args: ['-c', 'from libnvme import nvme'], env: test_env)