From: dwsteele (@dwsteele) <noreply+dwsteele@github.com>
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
Subject: Re: [pgaudit/pgaudit] issue #259: Coredump in log_select_dml()
Date: Thu, 25 Jun 2026 08:28:19 +0000
Message-ID: <gh-pgaudit-pgaudit-259-c4797299098@github.com> (raw)
In-Reply-To: <gh-pgaudit-pgaudit-259@github.com>
References: <gh-pgaudit-pgaudit-259@github.com>
@x4m @reshke A possible fix here would be something like:
```
+ contextOld = MemoryContextSwitchTo(auditEventStack->contextAudit);
+
auditEventStack->auditEvent.auditOid = auditOid;
- auditEventStack->auditEvent.rangeTabls = rangeTabls;
- auditEventStack->auditEvent.permInfos = permInfos;
+ auditEventStack->auditEvent.rangeTabls = copyObject(rangeTabls);
+ auditEventStack->auditEvent.permInfos = copyObject(permInfos);
+
+ MemoryContextSwitchTo(contextOld);
```
But seems like it would be pretty bad for performance. Considering this issue looks like it was caused by misuse of the hook chain I'm not sure it is worth it.
Some issues of this type should be handled by #250.
Thoughts?