[PATCH 39/44] leon, grspw_pkt: fix descriptor table mem leak on grspw_close()

Daniel Hellstrom daniel at gaisler.com
Fri Mar 3 14:57:12 UTC 2017


---
 c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c b/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
index aa83524..498333e 100644
--- a/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
+++ b/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
@@ -657,6 +657,12 @@ int grspw_close(void *d)
 	}
 	grspw_hw_stop(priv);
 
+	/* Free descriptor table memory if allocated using malloc() */
+	if (priv->bd_mem_alloced) {
+		free((void *)priv->bd_mem_alloced);
+		priv->bd_mem_alloced = 0;
+	}
+
 	/* Mark not open */
 	priv->open = 0;
 	rtems_semaphore_release(grspw_sem);
-- 
2.7.4




More information about the devel mailing list