[gnome-builder] clang: fixup warnings/leak when extracting header
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] clang: fixup warnings/leak when extracting header
- Date: Mon, 9 May 2016 06:38:07 +0000 (UTC)
commit afb57c501289eabdb5ae6038c394fdf7006a4b11
Author: Christian Hergert <chergert redhat com>
Date: Mon May 9 09:37:55 2016 +0300
clang: fixup warnings/leak when extracting header
Some leaks crept in during the hover-mouse for includes. This fixes those
up and fixes a warning that lead to their discovery.
plugins/clang/ide-clang-translation-unit.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/plugins/clang/ide-clang-translation-unit.c b/plugins/clang/ide-clang-translation-unit.c
index 78f8118..05a4d7a 100644
--- a/plugins/clang/ide-clang-translation-unit.c
+++ b/plugins/clang/ide-clang-translation-unit.c
@@ -957,21 +957,27 @@ ide_clang_translation_unit_lookup_symbol (IdeClangTranslationUnit *self,
{
CXFile included_file;
CXString included_file_name;
+ const gchar *path;
included_file = clang_getIncludedFile (cursor);
included_file_name = clang_getFileName (included_file);
+ path = clang_getCString (included_file_name);
- gfile = g_file_new_for_path (clang_getCString (included_file_name));
- file = g_object_new (IDE_TYPE_FILE,
- "context",
- context,
- "file",
- gfile,
- "path",
- clang_getCString (included_file_name),
- NULL);
-
- definition = ide_source_location_new (file, 0, 0, 0);
+ if (path != NULL)
+ {
+ gfile = g_file_new_for_path (path);
+ file = g_object_new (IDE_TYPE_FILE,
+ "context", context,
+ "file", gfile,
+ "path", path,
+ NULL);
+
+ g_clear_pointer (&definition, ide_symbol_unref);
+ definition = ide_source_location_new (file, 0, 0, 0);
+
+ g_clear_object (&file);
+ g_clear_object (&gfile);
+ }
}
cxstr = clang_getCursorDisplayName (cursor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]