[gnome-builder] clang: clear pointers to zero them out



commit 8266a0df225a0cdaa7902bf4b7fb13e35d244510
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 3 16:30:51 2018 -0800

    clang: clear pointers to zero them out

 src/plugins/clang/ide-clang-service.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/clang/ide-clang-service.c b/src/plugins/clang/ide-clang-service.c
index 2bfd47c..933fdc4 100644
--- a/src/plugins/clang/ide-clang-service.c
+++ b/src/plugins/clang/ide-clang-service.c
@@ -71,9 +71,9 @@ parse_request_free (gpointer data)
 {
   ParseRequest *request = data;
 
-  g_free (request->source_filename);
-  g_strfreev (request->command_line_args);
-  g_ptr_array_unref (request->unsaved_files);
+  g_clear_pointer (&request->source_filename, g_free);
+  g_clear_pointer (&request->command_line_args, g_strfreev);
+  g_clear_pointer (&request->unsaved_files, g_ptr_array_unref);
   g_clear_object (&request->file);
   g_slice_free (ParseRequest, request);
 }
@@ -186,7 +186,8 @@ static void
 clear_unsaved_file (gpointer data)
 {
   struct CXUnsavedFile *uf = data;
-  g_free ((gchar *)uf->Filename);
+
+  g_clear_pointer (&uf->Filename, g_free);
 }
 
 static const gchar *


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