Module: xenomai-jki
Branch: for-upstream
Commit: 1a671746a43ff2dc5f5603b94a61da60c69c99f8
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=1a671746a43ff2dc5f5603b94a61da60c69c99f8

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Fri Feb 26 18:42:35 2010 +0100

RTDM: Avoid leaking memory on rtdm_*_select_bind errors

We need to release the allocated xnselect_binding if we fail to hook it
into the select block.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 ksrc/skins/rtdm/drvlib.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ksrc/skins/rtdm/drvlib.c b/ksrc/skins/rtdm/drvlib.c
index 5181108..637f99e 100644
--- a/ksrc/skins/rtdm/drvlib.c
+++ b/ksrc/skins/rtdm/drvlib.c
@@ -1089,6 +1089,9 @@ int rtdm_event_select_bind(rtdm_event_t *event, 
rtdm_selector_t *selector,
                                                       RTDM_EVENT_PENDING));
        xnlock_put_irqrestore(&nklock, s);
 
+       if (err)
+               xnfree(binding);
+
        return err;
 }
 EXPORT_SYMBOL(rtdm_event_select_bind);
@@ -1370,6 +1373,9 @@ int rtdm_sem_select_bind(rtdm_sem_t *sem, rtdm_selector_t 
*selector,
                                    type, fd_index, (sem->value > 0));
        xnlock_put_irqrestore(&nklock, s);
 
+       if (err)
+               xnfree(binding);
+
        return err;
 }
 EXPORT_SYMBOL(rtdm_sem_select_bind);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to