[gjs/wip/ptomato/various: 2/2] WIP - memory leaks from valgrind
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/various: 2/2] WIP - memory leaks from valgrind
- Date: Tue, 7 Feb 2017 22:55:26 +0000 (UTC)
commit 8ba6c03ce31e36c26628a2b5d6c1528894c03404
Author: Philip Chimento <philip endlessm com>
Date: Tue Feb 7 14:51:02 2017 -0800
WIP - memory leaks from valgrind
gjs/context.cpp | 2 ++
gjs/coverage.cpp | 6 +++---
test/gjs-test-call-args.cpp | 3 ++-
3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 222a178..94b1985 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -345,6 +345,7 @@ gjs_context_class_init(GjsContextClass *klass)
g_object_class_install_property(object_class,
PROP_SEARCH_PATH,
pspec);
+ g_param_spec_unref(pspec);
pspec = g_param_spec_string("program-name",
"Program Name",
@@ -355,6 +356,7 @@ gjs_context_class_init(GjsContextClass *klass)
g_object_class_install_property(object_class,
PROP_PROGRAM_NAME,
pspec);
+ g_param_spec_unref(pspec);
/* For GjsPrivate */
{
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index f75a065..5434632 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -292,7 +292,7 @@ copy_source_file_to_coverage_output(GFile *source_file,
/* We need to recursively make the directory we
* want to copy to, as g_file_copy doesn't do that */
- GFile *destination_dir = g_file_get_parent(destination_file);
+ g_autoptr(GFile) destination_dir = g_file_get_parent(destination_file);
if (!g_file_make_directory_with_parents(destination_dir, NULL, &error)) {
if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_EXISTS))
goto fail;
@@ -1037,8 +1037,8 @@ gjs_deserialize_cache_to_object_for_compartment(JSContext *context,
global_object));
gsize len = 0;
- gpointer string = g_bytes_unref_to_data(g_bytes_ref(cache_data),
- &len);
+ g_autofree gpointer string = g_bytes_unref_to_data(g_bytes_ref(cache_data),
+ &len);
return JS_NewStringCopyN(context, (const char *) string, len);
}
diff --git a/test/gjs-test-call-args.cpp b/test/gjs-test-call-args.cpp
index 90414a3..8cbd827 100644
--- a/test/gjs-test-call-args.cpp
+++ b/test/gjs-test-call-args.cpp
@@ -85,7 +85,8 @@ JSNATIVE_TEST_FUNC_END
JSNATIVE_TEST_FUNC_BEGIN(one_of_each_type)
bool boolval;
- char *strval, *fileval;
+ g_autofree char *strval;
+ g_autofree char *fileval;
int intval;
unsigned uintval;
int64_t int64val;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]