This is an automated email from Gerrit.

Alamy Liu ([email protected]) just uploaded a new patch set to Gerrit, which 
you can find at http://openocd.zylin.com/3287

-- gerrit

commit 14227ac5f4a2643b79a197a9f7f3fa2f5de35015
Author: Alamy Liu <[email protected]>
Date:   Tue Aug 18 16:16:33 2015 -0700

    target/target: Add pointer checking after malloc()
    
    Change-Id: Ic7440380cab2fe79d05deff3a34a62f1b04cd782
    Signed-off-by: Alamy Liu <[email protected]>

diff --git a/src/target/target.c b/src/target/target.c
index 8c9f685..1c17fdb 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -1746,14 +1746,15 @@ int target_alloc_working_area_try(struct target 
*target, uint32_t size, struct w
 
                /* Set up initial working area on first call */
                struct working_area *new_wa = malloc(sizeof(*new_wa));
-               if (new_wa) {
-                       new_wa->next = NULL;
-                       new_wa->size = target->working_area_size & ~3UL; /* 
4-byte align */
-                       new_wa->address = target->working_area;
-                       new_wa->backup = NULL;
-                       new_wa->user = NULL;
-                       new_wa->free = true;
-               }
+               if (new_wa == NULL)
+                       return ERROR_FAIL;
+
+               new_wa->next = NULL;
+               new_wa->size = target->working_area_size & ~3UL; /* 4-byte 
align */
+               new_wa->address = target->working_area;
+               new_wa->backup = NULL;
+               new_wa->user = NULL;
+               new_wa->free = true;
 
                target->working_areas = new_wa;
        }

-- 

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to