temp is assigned the pointer returned by malloc which is used without a
NULL check and then never freed. Add a NULL check and ensure temp is
freed on all return paths.
This issue was found by Smatch.
Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: Anshul Dalal <anshuld@ti.com>
dev_err(dev, "%s resource type ids not available\n", of_prop);
return ERR_PTR(sets);
}
- temp = malloc(sets);
+ temp = devm_kmalloc(dev, sets, GFP_KERNEL);
+ if (!temp)
+ return ERR_PTR(-ENOMEM);
+
sets /= sizeof(u32);
res->sets = sets;
return ERR_PTR(-ENOMEM);
}
+ devm_kfree(dev, temp);
if (valid_set)
return res;