[Fix] Fix two memory leaks

delete is NULL safe