[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Tomasz Kojm tkojm at clamav.net
Sun Apr 4 01:07:13 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit e6f5ac515713d048a2a6e028255a58cbe03d83cf
Author: Tomasz Kojm <tkojm at clamav.net>
Date:   Thu Oct 8 19:04:31 2009 +0200

    libclamav/matcher-bm.c: don't use mpool (bb#1710, #1715)

diff --git a/ChangeLog b/ChangeLog
index 239676c..bcfdc06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Oct  8 19:03:57 CEST 2009 (tk)
+----------------------------------
+ * libclamav/matcher-bm.c: don't use mpool (bb#1710, #1715)
+
 Tue Oct  6 22:51:00 CEST 2009 (tk)
 ----------------------------------
  * shared/misc.h: #include <sys/types.h>
diff --git a/libclamav/matcher-bm.c b/libclamav/matcher-bm.c
index 9733785..05de59d 100644
--- a/libclamav/matcher-bm.c
+++ b/libclamav/matcher-bm.c
@@ -167,15 +167,15 @@ int cli_bm_initoff(const struct cli_matcher *root, struct cli_bm_off *data, int
     info.fsize = sb.st_size;
 
     data->cnt = data->pos = 0;
-    data->offtab = (uint32_t *) mpool_malloc(root->mempool, root->bm_patterns * sizeof(uint32_t));
+    data->offtab = (uint32_t *) cli_malloc(root->bm_patterns * sizeof(uint32_t));
     if(!data->offtab) {
 	cli_errmsg("cli_bm_initoff: Can't allocate memory for data->offtab\n");
 	return CL_EMEM;
     }
-    data->offset = (uint32_t *) mpool_malloc(root->mempool, root->bm_patterns * sizeof(uint32_t));
+    data->offset = (uint32_t *) cli_malloc(root->bm_patterns * sizeof(uint32_t));
     if(!data->offset) {
 	cli_errmsg("cli_bm_initoff: Can't allocate memory for data->offset\n");
-	mpool_free(root->mempool, data->offtab);
+	free(data->offtab);
 	return CL_EMEM;
     }
     for(i = 0; i < root->bm_patterns; i++) {
@@ -187,8 +187,8 @@ int cli_bm_initoff(const struct cli_matcher *root, struct cli_bm_off *data, int
 	    cli_errmsg("cli_bm_initoff: Can't calculate relative offset in signature for %s\n", patt->virname);
 	    if(info.exeinfo.section)
 		free(info.exeinfo.section);
-	    mpool_free(root->mempool, data->offtab);
-	    mpool_free(root->mempool, data->offset);
+	    free(data->offtab);
+	    free(data->offset);
 	    return ret;
 	} else if((data->offset[patt->offset_min] != CLI_OFF_NONE) && (data->offset[patt->offset_min] + patt->length <= info.fsize)) {
 	    if(!data->cnt || (data->offset[patt->offset_min] != data->offtab[data->cnt - 1])) {
@@ -204,14 +204,12 @@ int cli_bm_initoff(const struct cli_matcher *root, struct cli_bm_off *data, int
     return CL_SUCCESS;
 }
 
-void cli_bm_freeoff(struct cli_bm_off *data, const struct cli_matcher *root)
+void cli_bm_freeoff(struct cli_bm_off *data)
 {
-    if(data->offset) {
-	mpool_free(root->mempool, data->offset);
-	data->offset = NULL;
-	mpool_free(root->mempool, data->offtab);
-	data->offtab = NULL;
-    }
+    free(data->offset);
+    data->offset = NULL;
+    free(data->offtab);
+    data->offtab = NULL;
 }
 
 void cli_bm_free(struct cli_matcher *root)
diff --git a/libclamav/matcher-bm.h b/libclamav/matcher-bm.h
index 65e4705..3996e98 100644
--- a/libclamav/matcher-bm.h
+++ b/libclamav/matcher-bm.h
@@ -45,7 +45,7 @@ struct cli_bm_off {
 int cli_bm_addpatt(struct cli_matcher *root, struct cli_bm_patt *pattern, const char *offset);
 int cli_bm_init(struct cli_matcher *root);
 int cli_bm_initoff(const struct cli_matcher *root, struct cli_bm_off *data, int fd);
-void cli_bm_freeoff(struct cli_bm_off *data, const struct cli_matcher *root);
+void cli_bm_freeoff(struct cli_bm_off *data);
 int cli_bm_scanbuff(const unsigned char *buffer, uint32_t length, const char **virname, const struct cli_bm_patt **patt, const struct cli_matcher *root, uint32_t offset, int fd, struct cli_bm_off *offdata);
 void cli_bm_free(struct cli_matcher *root);
 
diff --git a/libclamav/matcher.c b/libclamav/matcher.c
index c58deb1..e0e0008 100644
--- a/libclamav/matcher.c
+++ b/libclamav/matcher.c
@@ -443,7 +443,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struc
 		    cli_ac_freedata(&gdata);
 		cli_ac_freedata(&tdata);
 		if(bm_offmode)
-		    cli_bm_freeoff(&toff, troot);
+		    cli_bm_freeoff(&toff);
 		return CL_VIRUS;
 	    }
 	}
@@ -458,7 +458,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struc
 		if(troot) {
 		    cli_ac_freedata(&tdata);
 		    if(bm_offmode)
-			cli_bm_freeoff(&toff, troot);
+			cli_bm_freeoff(&toff);
 		}
 		return CL_VIRUS;
 
@@ -502,7 +502,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struc
 	}
 	cli_ac_freedata(&tdata);
 	if(bm_offmode)
-	    cli_bm_freeoff(&toff, troot);
+	    cli_bm_freeoff(&toff);
     }
 
     if(groot) {

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list