[redland-dev] [Redland RDF API 0000372]: serialize_model_to_iostream closes iostream

Mantis Bug Tracker mantis-bug-sender at librdf.org
Sun May 23 15:22:30 CEST 2010


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.librdf.org/mantis/view.php?id=372 
====================================================================== 
Reported By:                normang
Assigned To:                
====================================================================== 
Project:                    Redland RDF API
Issue ID:                   372
Category:                   api
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2010-05-23 13:22
Last Modified:              2010-05-23 13:22
====================================================================== 
Summary:                    serialize_model_to_iostream closes iostream
Description: 
Consider:
    status = librdf_serializer_serialize_model_to_iostream(serializer,
                                                           base_uri,
                                                           model,
                                                           iostr);
    raptor_free_iostream(iostr);

Tracing this in the debugger, it turns out that
librdf_serializer_serialize_model_to_iostream calls raptor_free_iostream
internally:


(gdb) where
#0  0x014cf219 in raptor_free_iostream ()
#1  0x014c199e in raptor_serialize_end ()
#2  0x01446a2a in librdf_serializer_raptor_serialize_stream_to_iostream
()
#3  0x01446a92 in librdf_serializer_raptor_serialize_model_to_iostream ()

This causes a segfault when the application calls raptor_free_iostream
separately, which one would expect was the right thing to do, and which
isn't warned against in the docs (or at least not anywhere obvious). 
Suggestions:

  * avoid freeing the iostream within the serializer function
  * document that this happens, so that the iostream should not be freed
  * (optimal?) make raptor_free_iostream robust against re-freeing objects
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-05-23 13:22 normang        New Issue                                    
======================================================================



More information about the redland-dev mailing list