[augeas-devel] [PATCH 1 of 4] Split ref counting macros into separate header
David Lutterkort
dlutter at redhat.com
Fri May 9 04:42:39 UTC 2008
On Fri, 2008-05-09 at 00:30 -0400, James Antill wrote:
> On Thu, 2008-05-08 at 18:33 -0700, David Lutterkort wrote:
> > + if (--(s)->ref == 0) { \
> > + /*memset(s, 255, sizeof(*s));*/ \
> > + free_##t(s); \
> > + (s) = NULL; \
> > + } \
> > + } \
>
> I realise you're just moving this, but don't you want to move the "(s)
> = NULL" out of that block ... as I assume you don't normally want to
> unref() something twice?
Yes, you are right; I moved the "(s) = NULL" outside the outer 'if' -
once you unref a pointer you should never access it again.
David
More information about the augeas-devel
mailing list