title: valgrind definitely lost block calling function
body: <p>I have a problem figuring out why I get definitely lost error in following code. I have changed return 0 to exit (0) in main function but it does not help. </p>
  
  <pre><code>struct s* function(int K,struct graph *G,int c){
      uint32_t *a;
      a=(uint32_t*)calloc(K+2,sizeof(uint32_t));
      int *b;
      b=(uint32_t*)calloc(K+2,sizeof(uint32_t));
      return s;
  }
  
  int main(int argc, char *argv[])
  {
      struct S* s=function(K,Gprime,capacity);
      return 0;
  }
  </code></pre>
  
  <p>and Below you can see the S structure code:</p>
  
  <pre><code>struct S{
      int *S;
      uint32_t *Scount;
  };
  
  struct S* Sp(int s,int k){
      struct S* sz =malloc(sizeof (struct S));
      sz-&gt;S = (int*)calloc(s+1, sizeof(int));
      sz-&gt;scount=(uint32_t*)calloc(k+1,sizeof(uint32_t));
      return sz;
  }
  </code></pre>
  
  <p>and here is the valgrind error : </p>
  
  <pre><code>==5343== 680 bytes in 5 blocks are definitely lost in loss record 10 of 52
  ==5343==    at 0x4C272B8: calloc (vg_replace_malloc.c:566)
  ==5343==    by 0x40106B: function (reflowk.c:3)
  ==5343==    by 0x402BB0: main (reflowk.c:9)
  </code></pre>