[PATCH:libICE] Plug minor memory leak in unusual path through ProcessConnectionSetup

Alan Coopersmith alan.coopersmith at oracle.com
Mon Nov 28 19:01:37 PST 2011


Error: Memory leak (CWE 401)
   Memory leak of pointer 'release' allocated with malloc((_len + 1))
        at line 1100 of src/process.c in function 'ProcessConnectionSetup'.
          'release' allocated at line 920 with malloc((_len + 1)).
          release leaks when _i >= hisAuthCount at line 925
              and i >= _IceAuthCount at line 973
              and found != 0 at line 998
              and status != 0 at line 1053
              and status != 1 at line 1070
              and accept_setup_now == 0 at line 1082
              and i >= hisAuthCount at line 1093.
   Memory leak of pointer 'vendor' allocated with malloc((_len + 1))
        at line 1100 of src/process.c in function 'ProcessConnectionSetup'.
          'vendor' allocated at line 919 with malloc((_len + 1)).
          vendor leaks when _i >= hisAuthCount at line 925
              and i >= _IceAuthCount at line 973
              and found != 0 at line 998
              and status != 0 at line 1053
              and status != 1 at line 1070
              and accept_setup_now == 0 at line 1082
              and i >= hisAuthCount at line 1093.

[ This bug was found by the Parfait 0.3.7 bug checking tool.
  For more information see http://labs.oracle.com/projects/parfait/ ]

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/process.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/process.c b/src/process.c
index 1e53ef9..2708ee8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1071,6 +1071,11 @@ ProcessConnectionSetup (
 	{
 	    accept_setup_now = 1;
 	}
+	else
+	{
+	    free (vendor);
+	    free (release);
+	}
 
 	if (authData && authDataLen > 0)
 	    free ((char *) authData);
-- 
1.7.3.2



More information about the xorg-devel mailing list