summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2017-02-07 14:51:02 -0800
committerPhilip Chimento <philip@endlessm.com>2017-02-07 14:51:02 -0800
commit8ba6c03ce31e36c26628a2b5d6c1528894c03404 (patch)
treea9468b1f89e0f92e2f6c65295abe20376e11b11e
parent2c091b923f2b00fc79aaa6243582021d9e04e30f (diff)
downloadgjs-wip/ptomato/various.tar.gz
WIP - memory leaks from valgrindwip/ptomato/various
-rw-r--r--gjs/context.cpp2
-rw-r--r--gjs/coverage.cpp6
-rw-r--r--test/gjs-test-call-args.cpp3
3 files changed, 7 insertions, 4 deletions
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 222a178a..94b1985c 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 f75a0655..5434632a 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 90414a32..8cbd8277 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;