summaryrefslogtreecommitdiffstats
path: root/tools/omfwd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-01-14 18:22:16 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2012-01-14 18:22:16 +0100
commitac64c118ea9ea69edfc1ab698d5413fa3485fc94 (patch)
treeaab4fa64ef29478225f4ce50d856331c813923dd /tools/omfwd.c
parent45ba66d14acd1910869c8e5c3fb1255150eeb629 (diff)
downloadrsyslog-ac64c118ea9ea69edfc1ab698d5413fa3485fc94.tar.gz
rsyslog-ac64c118ea9ea69edfc1ab698d5413fa3485fc94.tar.xz
rsyslog-ac64c118ea9ea69edfc1ab698d5413fa3485fc94.zip
omfwd refactor: simplification
at the same time, remove commits - 8c3ab2e26f1bae46ff34fc1d0a10a69c4db78127 - 009738a0ac6ba0dccf403f9e396095f44e4f9ac6
Diffstat (limited to 'tools/omfwd.c')
-rw-r--r--tools/omfwd.c15
1 files changed, 6 insertions, 9 deletions
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