[PATCH] record: move free() to after last use of pContext

Matt Turner mattst88 at gmail.com
Fri Jun 4 18:23:20 PDT 2010


No functional change, since free doesn't change the value of the pointer
passed to it, but it makes this code less confusing.

Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
Alan, I saw this when looking through your parfait results.

It looks like RecordFindContextOnAllContexts's argument should be marked
const also.

 record/record.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/record/record.c b/record/record.c
index 46231c9..bfc95bb 100644
--- a/record/record.c
+++ b/record/record.c
@@ -2522,8 +2522,6 @@ RecordDeleteContext(pointer value, XID id)
 	}
     }
 
-    free(pContext);
-
     /* remove context from AllContexts list */
 
     if (-1 != (i = RecordFindContextOnAllContexts(pContext)))
@@ -2535,6 +2533,8 @@ RecordDeleteContext(pointer value, XID id)
 	    ppAllContexts = NULL;
 	}
     }
+    free(pContext);
+
     return Success;
 } /* RecordDeleteContext */
 
-- 
1.6.4.4



More information about the xorg-devel mailing list