summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tests/leak_check.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tests/leak_check.c b/src/tests/leak_check.c
index 06941195d..bb5698cd8 100644
--- a/src/tests/leak_check.c
+++ b/src/tests/leak_check.c
@@ -55,6 +55,10 @@ _check_leaks(TALLOC_CTX *ctx, size_t bytes, const char *location)
{
size_t bytes_allocated;
+ if (ctx == NULL) {
+ return false;
+ }
+
bytes_allocated = talloc_total_size(ctx);
if (bytes_allocated != bytes) {
fprintf(stderr, "Leak report for %s:\n", location);
@@ -85,6 +89,10 @@ _check_leaks_pop(TALLOC_CTX *ctx, const char *location)
TALLOC_CTX *old_ctx;
size_t bytes_allocated;
+ if (ctx == NULL) {
+ return false;
+ }
+
if (snapshot_stack == NULL) {
_set_leak_err_msg("%s: trying to pop an empty stack", location);
return false;