title: Valgrind blocks are definitely lost in loss record
body: <p>I am trying to figure out what is wrong with my valgrind debugging. I am learning this valgrind slowly.</p>
  
  <p>debug:</p>
  
  <pre><code>==1701== HEAP SUMMARY:
  ==1701==     in use at exit: 390 bytes in 12 blocks
  ==1701==   total heap usage: 59 allocs, 47 frees, 1,097 bytes allocated
  ==1701==
  ==1701== 39 bytes in 1 blocks are definitely lost in loss record 6 of 12
  ==1701==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==1701==    by 0x401246: songToString (song.c:147)
  ==1701==    by 0x40083C: main (songtest.c:52)
  ==1701==
  </code></pre>
  
  <p>Code (songToString function):</p>
  
  <pre><code>char *songToString(const song *s)
  {
      char *sstr = NULL ;
      char *st = NULL ;
      char *sa = NULL ;
      char *tt = NULL ;
      int len = 0 ;
  
      st = songGetTitle(s) ;
      sa = songGetArtist(s) ;
  
      // calculate the total string length needed.
      len = strlen("Title: ") + strlen(st) +
                    strlen("  Artist: ") + strlen(sa) + 1 ;
  
      if (NULL != s-&gt;lastPlayed)
      {
          tt = mtimeToString(s-&gt;lastPlayed) ;
          len += strlen(" at ") + strlen(tt) ;
      }
  
      // allocate enough space for the song
      sstr = malloc( len ) ;
  
      sprintf(sstr, "Title: %s  Artist: %s", st, sa) ;
  
      if (NULL != s-&gt;lastPlayed)
      {
          sstr = strcat(sstr, " at ") ;
          sstr = strcat(sstr, tt) ;
      }
  
      free(sa) ;
      free(st) ;
      free(tt) ;
      return sstr ;
  }
  </code></pre>
  
  <p>In songToString, line 147 is <code>sstr = malloc( len ) ;</code></p>
  
  <p>in songTest (line 52):</p>
  
  <pre><code>char * sstr = songToString( song1 ) ;
  </code></pre>
  
  <p>Any help would be great. Thank you.</p>