[redland] Redland giving seg fault in a loop.
Dave Beckett
dave.beckett at bristol.ac.uk
Mon Oct 29 13:47:24 GMT 2001
>>>Art Barstow said:
> On Mon, Oct 29, 2001 at 10:22:04AM +0000, Dave Beckett wrote:
> > 18 librdf_free_world(rlworld);
> > 19 if (rlworld != NULL) {
>
> I haven't done much C hacking recently but my recollection
> is that one should be very careful about dereferencing a pointer
> after it is freed. In this case, the documentation for librdf_free_world:
>
> http://www.redland.opensource.ac.uk/docs/api/r85.html
>
> doesn't explicitly say that it sets its pointer to NULL so it
> seem like a bad idea to do the above.
This is a pointer comparison, not a dereference (*rlworld would be).
rlworld can never be set to NULL after the call to librdf_free_world
since it is passed by value rather than by reference.
So although the if(...) above is not necessary, since it always
succeeds and should be removed, it is not really wrong.
Dave
More information about the redland-dev
mailing list