From ac64c118ea9ea69edfc1ab698d5413fa3485fc94 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sat, 14 Jan 2012 18:22:16 +0100 Subject: omfwd refactor: simplification at the same time, remove commits - 8c3ab2e26f1bae46ff34fc1d0a10a69c4db78127 - 009738a0ac6ba0dccf403f9e396095f44e4f9ac6 --- tools/omfwd.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'tools/omfwd.c') diff --git a/tools/omfwd.c b/tools/omfwd.c index 0156fbfc..46c13dc9 100644 --- a/tools/omfwd.c +++ b/tools/omfwd.c @@ -396,9 +396,12 @@ CODESTARTtryResume ENDtryResume BEGINdoAction - char *psz = NULL; /* temporary buffering */ + char *psz; /* temporary buffering */ register unsigned l; int iMaxLine; +# ifdef USE_NETZIP + Bytef *out = NULL; /* for compression */ +# endif CODESTARTdoAction CHKiRet(doTryResume(pData)); @@ -422,7 +425,6 @@ CODESTARTdoAction * rgerhards, 2006-11-30 */ if(pData->compressionLevel && (l > CONF_MIN_SIZE_FOR_COMPRESS)) { - Bytef *out; uLongf destLen = iMaxLine + iMaxLine/100 +12; /* recommended value from zlib doc */ uLong srcLen = l; int ret; @@ -443,14 +445,11 @@ CODESTARTdoAction * rgerhards, 2006-11-30 */ dbgprintf("Compression failed, sending uncompressed message\n"); - free(out); } else if(destLen+1 < l) { /* only use compression if there is a gain in using it! */ dbgprintf("there is gain in compression, so we do it\n"); psz = (char*) out; l = destLen + 1; /* take care for the "z" at message start! */ - } else { - free(out); } ++destLen; } @@ -472,10 +471,8 @@ CODESTARTdoAction } finalize_it: # ifdef USE_NETZIP - if((psz != NULL) && (psz != (char*) ppString[0])) { - /* we need to free temporary buffer, alloced above - Naoya Nakazawa, 2010-01-11 */ - free(psz); - } + if(out != NULL) + free(out); # endif ENDdoAction -- cgit