[Mesa-dev] [PATCH 2/2] glsl: Check for null pointer at ir_variable_refcount_visitor()
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Thu Feb 4 15:17:40 UTC 2016
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
On Wed, 2016-02-03 at 10:56 +0200, Juha-Pekka Heikkila wrote:
> Look after calloc give memory address.
>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
> src/compiler/glsl/ir_variable_refcount.cpp | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/src/compiler/glsl/ir_variable_refcount.cpp
> b/src/compiler/glsl/ir_variable_refcount.cpp
> index 8306be1..942ef25 100644
> --- a/src/compiler/glsl/ir_variable_refcount.cpp
> +++ b/src/compiler/glsl/ir_variable_refcount.cpp
> @@ -34,6 +34,7 @@
> #include "ir_variable_refcount.h"
> #include "compiler/glsl_types.h"
> #include "util/hash_table.h"
> +#include "main/errors.h"
>
> ir_variable_refcount_visitor::ir_variable_refcount_visitor()
> {
> @@ -144,6 +145,12 @@
> ir_variable_refcount_visitor::visit_leave(ir_assignment *ir)
> if (entry->referenced_count == entry->assigned_count) {
> struct assignment_entry *assignment_entry =
> (struct assignment_entry *)calloc(1,
> sizeof(*assignment_entry));
> +
> + if (!assignment_entry) {
> + _mesa_error_no_memory(__func__);
> + return visit_stop;
> + }
> +
> assignment_entry->assign = ir;
> entry->assign_list.push_head(&assignment_entry->link);
> }
More information about the mesa-dev
mailing list