Added security check to csp_buffer_free