<<< split from This may be due to a corruption of the heap >>>
READ THE RULES
i have the same problem on visual studio 2010. Here is the code:
i compiled and runned program on devcpp and codeblocks and they didnt noticed any errorsCode:#include "stdafx.h" #include <stdio.h> #include <stdlib.h> typedef char labeltype; typedef struct __celltype { labeltype label; struct __celltype *first_child; struct __celltype *next_sib; struct __celltype *last_child; int zadnji; } celltype; typedef celltype *node; typedef celltype *TREE; void MAKE_NULL( TREE* X ){ celltype* novo_stablo = (TREE)malloc( sizeof( celltype ) ); *X = novo_stablo; (*X)->label = '\0'; (*X)->first_child = NULL; (*X)->next_sib = NULL; (*X)->last_child = NULL; (*X)->zadnji = 1; } void __FREE( TREE* stablo ){ celltype* pom = (*stablo) -> next_sib; if( (*stablo) -> first_child != NULL ) __FREE( &( (*stablo)->first_child ) ); if( pom == NULL ){ free( stablo ); return; } while( pom != NULL ){ celltype* brisi = *stablo; *stablo = pom; pom = pom ->next_sib; free( brisi ); } return; } int _tmain(int argc, _TCHAR* argv[]) { TREE X; MAKE_NULL( &X ); __FREE( &X ); // here is the error by visual studio return 0; }