From 44f7ba266a5ae2cf12dfe60d37c1764de3fade9f Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Mon, 11 Dec 2017 14:10:07 +0100 Subject: [PATCH] Make valgrind check more useful * make valgrind now fails when valgrind detects a definitive memory leak * suppress a known memory leak in OpenLDAP's NSS module https://github.com/python-ldap/python-ldap/pull/111 Signed-off-by: Christian Heimes --- Makefile | 10 +++++++++- Misc/python-ldap.supp | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 150981c..e4ff75a 100644 --- a/Makefile +++ b/Makefile @@ -63,9 +63,17 @@ $(PYTHON_SUPP): exit 1; valgrind: build $(PYTHON_SUPP) - valgrind --leak-check=full \ + valgrind \ + --leak-check=full \ + --track-fds=yes \ --suppressions=$(PYTHON_SUPP) \ --suppressions=Misc/python-ldap.supp \ --gen-suppressions=all \ --log-file=build/valgrind.log \ $(PYTHON) setup.py test + + @grep -A7 "blocks are definitely lost" build/valgrind.log; \ + if [ $$? == 0 ]; then \ + echo "Found definitive leak, see build/valgrind.log"; \ + exit 1; \ + fi diff --git a/Misc/python-ldap.supp b/Misc/python-ldap.supp index de70446..3267fd0 100644 --- a/Misc/python-ldap.supp +++ b/Misc/python-ldap.supp @@ -27,6 +27,16 @@ ... } +{ + NSS backend leaks one string during first initialization + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:PL_strdup + fun:tlsm_init + ... +} + { Ignore possible leaks in exception initialization Memcheck:Leak