rsyslog/rsyslog-1.19.0-ommysqlLeak.patch
2007-08-22 15:36:20 +00:00

80 lines
2.7 KiB
Diff

--- rsyslog/ommysql.c.orig 2007-08-16 17:06:10.000000000 +0200
+++ rsyslog/ommysql.c 2007-08-16 17:07:02.000000000 +0200
@@ -229,7 +229,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(
/* ok, if we reach this point, we have something for us */
if((iRet = createInstance(&pData)) != RS_RET_OK)
- return iRet;
+ goto finalize_it;
p++; /* eat '>' '*/
--- rsyslog/omusrmsg.c.orig 2007-08-16 17:07:20.000000000 +0200
+++ rsyslog/omusrmsg.c 2007-08-16 17:11:52.000000000 +0200
@@ -272,10 +272,10 @@ CODE_STD_STRING_REQUESTparseSelectorAct(
*/
if (!*p || !((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z')
|| (*p >= '0' && *p <= '9') || *p == '_' || *p == '.' || *p == '*'))
- return RS_RET_CONFLINE_UNPROCESSED;
+ ABORT_FINALIZE(RS_RET_CONFLINE_UNPROCESSED);
if((iRet = createInstance(&pData)) != RS_RET_OK)
- return iRet;
+ goto finalize_it;
if(*p == '*') { /* wall */
@@ -284,7 +284,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(
pData->bIsWall = 1; /* write to all users */
if((iRet = cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (uchar*) " WallFmt"))
!= RS_RET_OK)
- return iRet;
+ goto finalize_it;
} else {
/* everything else beginning with the regex above
* is currently treated as a user name
@@ -309,7 +309,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(
*/
if((iRet = cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (uchar*)" StdUsrMsgFmt"))
!= RS_RET_OK)
- return iRet;
+ goto finalize_it;
}
CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct
--- rsyslog/rsyslog.h.orig 2007-08-16 17:13:38.000000000 +0200
+++ rsyslog/rsyslog.h 2007-08-16 17:15:47.000000000 +0200
@@ -82,9 +82,11 @@ typedef enum rsRetVal_ rsRetVal; /**< fr
/* macro below is to be used if we need our own handling, eg for cleanup */
#define CHKiRet_Hdlr(code) if((iRet = code) != RS_RET_OK)
#define DEFiRet rsRetVal iRet = RS_RET_OK
-#define ABORT_FINALIZE(errCode) \
- iRet = errCode;\
- goto finalize_it;
+#define ABORT_FINALIZE(errCode) \
+ do { \
+ iRet = errCode; \
+ goto finalize_it; \
+ } while (0)
/** Object ID. These are for internal checking. Each
* object is assigned a specific ID. This is contained in
--- rsyslog/module-template.h.orig 2007-08-16 17:29:13.000000000 +0200
+++ rsyslog/module-template.h 2007-08-16 17:38:37.000000000 +0200
@@ -226,10 +226,13 @@ finalize_it:\
*pp = p;\
} else {\
/* cleanup, we failed */\
- if(*ppOMSR != NULL)\
+ if(*ppOMSR != NULL) {\
OMSRdestruct(*ppOMSR);\
*ppOMSR = NULL;\
- }
+ }\
+ if(pData != NULL)\
+ freeInstance(&pData);\
+ }
#define ENDparseSelectorAct \
return iRet;\