Fix memory leak in sample C program