fix leak in read_post_data + simplify parser code