[Skiboot] [RFC Coverity PATCH 2/2] core/interrupts: Fix resource leak in add_opal_interrupts()

Kamalesh Babulal kamalesh at linux.vnet.ibm.com
Wed Jul 1 15:04:28 AEST 2015


In add_opal_interrupts(), we allocate memory for irqs property.
Which is not freed, after property is added. There are chances
of irqs begin NULL, as free(NULL) is nop. It's harmless.

Fixes Coverity defect#98849.

Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
---
 core/interrupts.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/core/interrupts.c b/core/interrupts.c
index 9d79660..b91508f 100644
--- a/core/interrupts.c
+++ b/core/interrupts.c
@@ -191,6 +191,8 @@ void add_opal_interrupts(void)
 	 * handling in Linux can cause problems.
 	 */
 	dt_add_property(opal_node, "opal-interrupts", irqs, count * 4);
+
+	free(irqs);
 }
 
 /*
-- 
2.1.2



More information about the Skiboot mailing list