[En-Nut-Discussion] Need Help on URL Parse

iVesWorking ivesworking at hotmail.com
Mon Jul 26 15:00:10 CEST 2004


I using strtok_r to parse the URL, But i facing memory leak with strtok_r

this is what show on below 

  char *cp;  
  char *url;

  char *temp;

  url = NutHeapAlloc(128); 
  temp = NutHeapAlloc(128); 
     strcpy(temp,"192.168.125.0:800/index.html");
     cp = strtok_r(temp,":",&url);
     printf("IP%s\n",cp);

  NutHeapFree(url);
  NutHeapFree(temp);

This program will loss around 20-30Byte of the memory everytime it execute.
Any idea how to solve this problem ?

or any people have ready function that did  URL split to Host,Port,Path ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20040726/0ddf5f48/attachment-0001.html>


More information about the En-Nut-Discussion mailing list