From 92817a11aaf129404377d6639f28455544939b8a Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 26 Jul 2012 10:11:00 -0400 Subject: [PATCH] Avoid memory leak in test_event_calloc unit test; found by coverity --- test/regress_util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/regress_util.c b/test/regress_util.c index 0944f069..75c57c77 100644 --- a/test/regress_util.c +++ b/test/regress_util.c @@ -1150,6 +1150,7 @@ test_event_calloc(void *arg) tt_assert(p != NULL); tt_int_op(errno, ==, 0); mm_free(p); + p = NULL; /* mm_calloc() should set errno = ENOMEM and return NULL * in case of potential overflow. */ @@ -1160,6 +1161,9 @@ test_event_calloc(void *arg) end: errno = 0; + if (p) + mm_free(p); + return; }