[Mesa-dev] [Bug 99789] Memory leak on failure to create an ir_constant in calculate_iterations in loop_controls.cpp
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Mon Feb 13 10:09:47 UTC 2017
https://bugs.freedesktop.org/show_bug.cgi?id=99789
Bug ID: 99789
Summary: Memory leak on failure to create an ir_constant in
calculate_iterations in loop_controls.cpp
Product: Mesa
Version: git
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: medium
Component: glsl-compiler
Assignee: mesa-dev at lists.freedesktop.org
Reporter: damian.dixon at gmail.com
QA Contact: intel-3d-bugs at lists.freedesktop.org
There is a memory leak on failure to create an ir_constant in
calculate_iterations in loop_controls.cpp.
If iter is NULL the method returns without deleting the allocated memory.
See below:
int
calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
enum ir_expression_operation op)
{
if (from == NULL || to == NULL || increment == NULL)
return -1;
void *mem_ctx = ralloc_context(NULL);
ir_expression *const sub =
new(mem_ctx) ir_expression(ir_binop_sub, from->type, to, from);
ir_expression *const div =
new(mem_ctx) ir_expression(ir_binop_div, sub->type, sub, increment);
ir_constant *iter = div->constant_expression_value();
if (iter == NULL)
return -1;
If iter == NULL then I should be seeing something like:
if (iter == NULL) {
// sub & div are created as emplacement new so delete is not required
// unless meme_ctx has a destructor.
ralloc_free(mem_ctx);
return -1;
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170213/1d04fcbe/attachment.html>
More information about the mesa-dev
mailing list