From: Christophe CURIS <[email protected]>

As pointed by Coverity, the array used to build the result for the
function 'getStreamObjects' could leak in case of early return.

Signed-off-by: Christophe CURIS <[email protected]>
---
 WINGs/wtext.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/WINGs/wtext.c b/WINGs/wtext.c
index b57b6b3..074da89 100644
--- a/WINGs/wtext.c
+++ b/WINGs/wtext.c
@@ -2898,7 +2898,7 @@ static void releaseStreamObjects(void *data)
 
 static WMArray *getStreamObjects(WMText * tPtr, int sel)
 {
-       WMArray *array = WMCreateArrayWithDestructor(4, releaseStreamObjects);
+       WMArray *array;
        WMData *data;
        char *stream;
        unsigned short len;
@@ -2908,6 +2908,8 @@ static WMArray *getStreamObjects(WMText * tPtr, int sel)
        if (!stream)
                return NULL;
 
+       array = WMCreateArrayWithDestructor(4, releaseStreamObjects);
+
        start = stream;
        while (start) {
 
-- 
1.9.2


-- 
To unsubscribe, send mail to [email protected].

Reply via email to