the code causes a segfault after I called "atoi" function
<p>I created a function to parse strings look like "NAME:Sebastion | AGE:4 | DATE:8/2/2005", and I was trying to get the year "2005". I wrote a function as the following. a segfault occurs at the line when I call "atoi". The valgrind show me that </p>

<pre><code>           Invalid read of size 1
    ==25142==    at 0x5171167: ____strtol_l_internal (strtol_l.c:298)
    ==25142==    by 0x516DB6F: atoi (atoi.c:27)
    ==25142==    by 0x400AB4: inYear (prelab8.c:115)
    ==25142==    by 0x40094E: main (prelab8.c:46)
    ==25142==  Address 0x0 is not stack'd, malloc'd or (recently) free'd



int inYear(char* string)
{
      char* word;
      word= strtok(string, "|");
      word= strtok(NULL,"|");
      word= strtok(NULL,"|");
      char * new;
      new = strtok(word,":");
      new= strtok(NULL,"/");
      new= strtok(NULL,"/");
      new= strtok(NULL,"/");
      //printf("%s\n",new);
      int year;
      year= atoi(new); // segfault 
      //printf("%d\n",year);
       if(year!=2005)
       return 0;

      return 1; 
 }
</code></pre>