]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl fix a memory leak
authorEric Bollengier <eric@eb.homelinux.org>
Wed, 2 May 2007 13:57:01 +0000 (13:57 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Wed, 2 May 2007 13:57:01 +0000 (13:57 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4676 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/lib/bregex.c

index 174b64dd38f09fdfba99f9d31223c95f11f50270..2cd01baf936a2c95df3e52d75fc5d060d26bba24 100644 (file)
@@ -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,