I found out why the memset was failing and it was indeed a stupid mistake >.>