Fix memory leak in utils.c