1
I have the following structures:
typedef struct Node
{
char info[40];
struct Node *ant;
struct Node *prox;
}NoCDup;
typedef struct LDEC
{
NoCDup *cabeca;
NoCDup *cauda;
int tamanho;
}ListaCDup;
And also the function that initializes the double-connected and circular list:
ListaCDup *criar()
{
ListaCDup *p = (ListaCDup*) malloc (sizeof(ListaCDup));
p->cabeca = p->cauda = NULL;
p->tamanho = 0;
return p;
}
And in main simply:
int main(){
ListaCDup *l = criar();
ImprimeListaCDup(l);
return 0;
}
But when checking memory errors with Valgrind, I have the following problem:
==10879== in use at exit: 12 bytes in 1 blocks
==10879== total heap usage: 1 allocs, 0 frees, 12 bytes allocated
==10879==
==10879== 12 bytes in 1 blocks are definitely lost in loss record 1 of 1
==10879== at 0x482E27C: malloc (vg_replace_malloc.c:299)
==10879== by 0x10869E: criar (in /home/student/Downloads/lista)
==10879== by 0x108D3B: main (in /home/student/Downloads/lista)
Can anyone explain to me why?