On Fri, 12 Apr 2019 at 19:49, Józef Kucia joseph.kucia@gmail.com wrote:
+static int convert_root_signature_to_v1_1(struct vkd3d_versioned_root_signature_desc *dst,
const struct vkd3d_versioned_root_signature_desc *src)
+{
- const struct vkd3d_root_signature_desc *src_desc = &src->u.v_1_0;
- struct vkd3d_root_signature_desc1 *dst_desc = &dst->u.v_1_1;
- struct vkd3d_static_sampler_desc *samplers = NULL;
- struct vkd3d_root_parameter1 *parameters = NULL;
- int ret;
- if ((dst_desc->parameter_count = src_desc->parameter_count))
- {
if (!(parameters = vkd3d_calloc(dst_desc->parameter_count, sizeof(*parameters))))
{
ret = VKD3D_ERROR_OUT_OF_MEMORY;
goto fail;
}
if ((ret = convert_root_parameters_to_v_1_1(parameters, src_desc->parameters, src_desc->parameter_count)) < 0)
goto fail;
- }
- dst_desc->parameters = parameters;
- if ((dst_desc->static_sampler_count = src_desc->static_sampler_count))
- {
if (!(samplers = vkd3d_calloc(dst_desc->static_sampler_count, sizeof(*samplers))))
{
ret = VKD3D_ERROR_OUT_OF_MEMORY;
goto fail;
}
memcpy(samplers, src_desc->static_samplers, src_desc->static_sampler_count * sizeof(*samplers));
- }
- dst_desc->static_samplers = samplers;
- dst_desc->flags = src_desc->flags;
- return VKD3D_OK;
+fail:
- vkd3d_free(parameters);
Doesn't that potentially leak descriptor table ranges?