diff --git a/.pick_status.json b/.pick_status.json index f7dde8e307e..1e726b4658b 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -373,7 +373,7 @@ "description": "r600/sfn: fix memory leak related to sh_info->arrays", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "79ca456b4837b3bc21cf9ef3c03c505c4b4909f6" }, diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 11f71c4b444..d06e80e64b4 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -420,6 +420,9 @@ void r600_pipe_shader_destroy(struct pipe_context *ctx UNUSED, struct r600_pipe_ if (list_is_linked(&shader->shader.bc.cf)) r600_bytecode_clear(&shader->shader.bc); r600_release_command_buffer(&shader->command_buffer); + + if (shader->shader.arrays) + free(shader->shader.arrays); } /* diff --git a/src/gallium/drivers/r600/sfn/sfn_valuefactory.cpp b/src/gallium/drivers/r600/sfn/sfn_valuefactory.cpp index 4c9a822e52c..44248cd9bdf 100644 --- a/src/gallium/drivers/r600/sfn/sfn_valuefactory.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_valuefactory.cpp @@ -1053,7 +1053,8 @@ ValueFactory::get_shader_info(r600_shader *sh_info) if (!arrays.empty()) { sh_info->num_arrays = arrays.size(); - sh_info->arrays = new r600_shader_array[arrays.size()]; + sh_info->arrays = + (r600_shader_array *)malloc(sizeof(struct r600_shader_array) * arrays.size()); for (auto& arr : arrays) { sh_info->arrays->gpr_start = arr->sel();