[gedit] Fix a possible memory leak



commit 63e27dd76250089ecbd125737499cc7176105632
Author: Daniel Trebbien <dtrebbien gmail com>
Date:   Fri Feb 3 18:01:12 2012 -0500

    Fix a possible memory leak
    
    Moves the check `g_return_if_fail (timer != NULL)` to before MSG is
    allocated.

 gedit/gedit-debug.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gedit/gedit-debug.c b/gedit/gedit-debug.c
index 0752f46..43cae51 100644
--- a/gedit/gedit-debug.c
+++ b/gedit/gedit-debug.c
@@ -108,12 +108,14 @@ gedit_debug_message (GeditDebugSection  section,
 {
 	if (G_UNLIKELY (debug & section))
 	{	
+		va_list args;
+		gchar *msg;
+
 #ifdef ENABLE_PROFILING
 		gdouble seconds;
-#endif
 
-		va_list args;
-		gchar *msg;
+		g_return_if_fail (timer != NULL);
+#endif
 
 		g_return_if_fail (format != NULL);
 
@@ -122,8 +124,6 @@ gedit_debug_message (GeditDebugSection  section,
 		va_end (args);
 
 #ifdef ENABLE_PROFILING
-		g_return_if_fail (timer != NULL);
-
 		seconds = g_timer_elapsed (timer, NULL);
 		g_print ("[%f (%f)] %s:%d (%s) %s\n", 
 			 seconds, seconds - last,  file, line, function, msg);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]