diff options
author | Michael Biebl <biebl@debian.org> | 2011-02-23 11:27:02 +0100 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2011-02-23 11:27:02 +0100 |
commit | 0116bd2a5f70ce1065933c47903a3bb4cd4fe9e0 (patch) | |
tree | edc0fcff16e528fed98fe3bf77d566c32552835b /runtime | |
parent | 4d8f0c039c4fa44bb43d3cdbb0674cde8bb66de4 (diff) | |
download | rsyslog-0116bd2a5f70ce1065933c47903a3bb4cd4fe9e0.tar.gz |
Imported Upstream version 5.7.5upstream/5.7.5
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/msg.c | 10 | ||||
-rw-r--r-- | runtime/msg.h | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index e8be79d..fb4d574 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -677,6 +677,7 @@ static inline rsRetVal msgBaseConstruct(msg_t **ppThis) /* initialize members in ORDER they appear in structure (think "cache line"!) */ pM->flowCtlType = 0; pM->bDoLock = 0; + pM->bAlreadyFreed = 0; pM->iRefCount = 1; pM->iSeverity = -1; pM->iFacility = -1; @@ -803,6 +804,15 @@ CODESTARTobjDestruct(msg) if(currRefCount == 0) { /* DEV Debugging Only! dbgprintf("msgDestruct\t0x%lx, RefCount now 0, doing DESTROY\n", (unsigned long)pThis); */ + /* The if below is included to try to nail down a well-hidden bug causing + * segfaults. I hope that do to the test code the problem is sooner detected and + * thus we get better data for debugging and resolving it. -- rgerhards, 2011-02-23. + * TODO: remove when no longer needed. + */ + if(pThis->bAlreadyFreed) + abort(); + pThis->bAlreadyFreed = 1; + /* end debug code */ if(pThis->pszRawMsg != pThis->szRawMsg) free(pThis->pszRawMsg); freeTAG(pThis); diff --git a/runtime/msg.h b/runtime/msg.h index 4897959..26a07ac 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -61,7 +61,8 @@ struct msg { once data has entered the queue, this property is no longer needed. */ pthread_mutex_t mut; int iRefCount; /* reference counter (0 = unused) */ - sbool bDoLock; /* use the mutex? */ + sbool bDoLock; /* use the mutex? */ + sbool bAlreadyFreed; /* aid to help detect a well-hidden bad bug -- TODO: remove when no longer needed */ short iSeverity; /* the severity 0..7 */ short iFacility; /* Facility code 0 .. 23*/ short offAfterPRI; /* offset, at which raw message WITHOUT PRI part starts in pszRawMsg */ |