Module: xenomai-3
Branch: master
Commit: f928e4d39bf62c8bae1ceeda7d403d76e3a37ed8
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f928e4d39bf62c8bae1ceeda7d403d76e3a37ed8

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Aug 12 10:31:14 2015 +0200

vxworks/memPartLib: do not account for failed alloc

---

 lib/vxworks/memPartLib.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/vxworks/memPartLib.c b/lib/vxworks/memPartLib.c
index 932fc90..09adb13 100644
--- a/lib/vxworks/memPartLib.c
+++ b/lib/vxworks/memPartLib.c
@@ -156,6 +156,8 @@ void *memPartAlloc(PART_ID partId, unsigned int nBytes)
        __RT(pthread_mutex_lock(&mp->lock));
 
        p = heapobj_alloc(&mp->hobj, nBytes);
+       if (p == NULL)
+               goto out;
 
        mp->stats.numBytesAlloc += nBytes;
        mp->stats.numBlocksAlloc++;
@@ -163,7 +165,7 @@ void *memPartAlloc(PART_ID partId, unsigned int nBytes)
        mp->stats.numBlocksFree--;
        if (mp->stats.numBytesAlloc > mp->stats.maxBytesAlloc)
                mp->stats.maxBytesAlloc = mp->stats.numBytesAlloc;
-
+out:
        __RT(pthread_mutex_unlock(&mp->lock));
 
        return p;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to