From 6831daf4275f5be05135c4df249f56dfba2d1c59 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 18 May 2014 21:31:45 +0200 Subject: [PATCH] WINGs: fix memory leak in getStreamObjects (Coverity #50119) 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 --- WINGs/wtext.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WINGs/wtext.c b/WINGs/wtext.c index b57b6b38..074da89c 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) {