[redland] Redland giving seg fault in a loop.

Jan Grant jan.grant at bristol.ac.uk
Mon Oct 29 09:46:31 GMT 2001


Not officially connected with Redland (apart from sharing a building
with Dave) but...

On Mon, 29 Oct 2001 abhinkar at yahoo.com wrote:

> Hi All:
>
> I have a small routine which is giving me a seg fault. It gives me a
> seg fault as soon as I go into the loop the second time at line 8. Am
> I doing everything correctly? I could get rid of this problem by
> calling the librdf_new_world() call outside the loop. But if I would
> like to do it "this" way why is that I get a seg. fault at the second
> time. Am I missing some initializations..?
>
> 1   void main() {
> 2       int  i;
> 3	librdf_world    *rlworld;
> 4	librdf_uri	*rluri;
> 5       for (i =0;i<100;i++) {
> 6           rlworld = librdf_new_world();
> 7	    if (rlworld!=NULL) {
> 8               librdf_world_open(rlworld);
> 9           } else {
> 10               return 1;
> 11	    }
> 12	    rluri = librdf_new_uri(rlworld,"file:///some/uri");
> 13          librdf_free_uri(rlworld);
                              ^^^^^^^
> 14	    librdf_free_world(rlworld);
> 15          if (rlworld != NULL) {
> 16	       rlworld = 0;
> 17	    }
> 18      }
> 19  }

The marked code is wrong.


-- 
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287088 Fax +44 (0)117 9287112 RFC822 jan.grant at bris.ac.uk
(ECHOY GRUNTING) (EERIE WHISPERS) aren't subtitles great?







More information about the redland-dev mailing list