From 291146979ef523b2bff26ba2ed93703f81a85375 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Wed, 2 May 2007 13:57:01 +0000 Subject: [PATCH] ebl fix a memory leak git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4676 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/lib/bregex.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bacula/src/lib/bregex.c b/bacula/src/lib/bregex.c index 174b64dd38..2cd01baf93 100644 --- a/bacula/src/lib/bregex.c +++ b/bacula/src/lib/bregex.c @@ -1102,7 +1102,7 @@ const char *re_compile_pattern(regex_t * bufp, unsigned char *regex) alloc = bufp->allocated; if (alloc == 0 || pattern == NULL) { alloc = 256; - pattern = (unsigned char *)malloc(alloc); + bufp->buffer = pattern = (unsigned char *)malloc(alloc); if (!pattern) goto out_of_memory; } @@ -1521,6 +1521,10 @@ void regfree(regex_t * preg) free_pool_memory(preg->lcase); preg->lcase = NULL; } + if (preg->buffer) { + free(preg->buffer); + preg->buffer = NULL; + } } int re_match(regex_t * bufp, unsigned char *string, int size, int pos, -- 2.39.5