[gjs: 1/7] console: Free profiler output path at different points
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/7] console: Free profiler output path at different points
- Date: Tue, 13 Mar 2018 21:01:00 +0000 (UTC)
commit 72594df1268390d51792a67171a43be30536981d
Author: Philip Chimento <philip chimento gmail com>
Date: Mon Mar 12 16:22:05 2018 -0700
console: Free profiler output path at different points
This avoids leaking the path when providing the argument more than once,
or when providing the argument in interactive mode.
See #120.
gjs/console.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gjs/console.cpp b/gjs/console.cpp
index 61e8c77..9e8deec 100644
--- a/gjs/console.cpp
+++ b/gjs/console.cpp
@@ -100,6 +100,7 @@ parse_profile_arg(const char *option_name,
GError **error_out)
{
enable_profiler = true;
+ g_free(profile_output_path);
if (value)
profile_output_path = g_strdup(value);
return true;
@@ -115,7 +116,6 @@ check_stray_profile_arg(const char *option_name,
"command line. Support for this will be removed in a future "
"version. Place the option before the script or use the "
"GJS_ENABLE_PROFILER environment variable.");
- g_free(profile_output_path);
return parse_profile_arg(option_name, value, data, error_out);
}
@@ -320,7 +320,6 @@ main(int argc, char **argv)
if (enable_profiler && profile_output_path) {
GjsProfiler *profiler = gjs_context_get_profiler(js_context);
gjs_profiler_set_filename(profiler, profile_output_path);
- g_free(profile_output_path);
}
/* prepare command line arguments */
@@ -350,6 +349,7 @@ main(int argc, char **argv)
gjs_coverage_write_statistics(coverage);
g_free(coverage_output_path);
+ g_free(profile_output_path);
g_strfreev(coverage_prefixes);
if (coverage)
g_object_unref(coverage);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]