fix crash caused by free of uninitialized pointer