summaryrefslogtreecommitdiffstats
path: root/msg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-17 12:45:10 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-17 12:45:10 +0000
commited0363210c34002e5cfbab553506573f5b8a13a5 (patch)
tree518ce37551ddb1803b3f8d0ced8599b8b04cb984 /msg.c
parent6b8b242250123d6c3105b48cde831ef749c88647 (diff)
downloadrsyslog-ed0363210c34002e5cfbab553506573f5b8a13a5.tar.gz
rsyslog-ed0363210c34002e5cfbab553506573f5b8a13a5.tar.xz
rsyslog-ed0363210c34002e5cfbab553506573f5b8a13a5.zip
worked on threading
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/msg.c b/msg.c
index 948274bf..0961afd4 100644
--- a/msg.c
+++ b/msg.c
@@ -232,8 +232,12 @@ finalize_it:
/* Destructor for a msg "object". Must be called to dispose
* of a msg object.
*/
-rsRetVal MsgDestruct(msg_t * pM)
-{
+rsRetVal MsgDestruct(msg_t **ppM)
+{
+ msg_t *pM;
+
+ assert(ppM != NULL);
+ pM = *ppM;
assert(pM != NULL);
/* DEV Debugging only ! dbgprintf("MsgDestruct\t0x%lx, Ref now: %d\n", (unsigned long)pM, pM->iRefCount - 1); */
if(--pM->iRefCount == 0)
@@ -289,6 +293,7 @@ rsRetVal MsgDestruct(msg_t * pM)
rsCStrDestruct(pM->pCSMSGID);
funcDeleteMutex(pM);
free(pM);
+ *ppM = NULL;
}
return RS_RET_OK;
@@ -302,7 +307,7 @@ rsRetVal MsgDestruct(msg_t * pM)
#define tmpCOPYSZ(name) \
if(pOld->psz##name != NULL) { \
if((pNew->psz##name = srUtilStrDup(pOld->psz##name, pOld->iLen##name)) == NULL) {\
- MsgDestruct(pNew);\
+ MsgDestruct(&pNew);\
return NULL;\
}\
pNew->iLen##name = pOld->iLen##name;\
@@ -315,7 +320,7 @@ rsRetVal MsgDestruct(msg_t * pM)
#define tmpCOPYCSTR(name) \
if(pOld->pCS##name != NULL) {\
if(rsCStrConstructFromCStr(&(pNew->pCS##name), pOld->pCS##name) != RS_RET_OK) {\
- MsgDestruct(pNew);\
+ MsgDestruct(&pNew);\
return NULL;\
}\
}