Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Mon, 05 May 2014 14:03:25 UTC Commit: de57548a716045a1bbadac290758759dd1d050ce https://github.com/geany/geany/commit/de57548a716045a1bbadac290758759dd1d050...
Log Message: ----------- Fix a few unlikely corner-case leaks
Fix a few leaks that can only happen in case of programming error.
Thanks to Pavel Roschin and his cppcheck for spotting them!
Modified Paths: -------------- src/symbols.c src/templates.c src/utils.c
Modified: src/symbols.c 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -2396,10 +2396,11 @@ static void create_taglist_popup_menu(void)
static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc) { - gchar *f = g_build_filename(app->configdir, "ignore.tags", NULL); + gchar *f;
g_return_if_fail(!EMPTY(doc->real_path));
+ f = g_build_filename(app->configdir, "ignore.tags", NULL); if (utils_str_equal(doc->real_path, f)) load_c_ignore_tags();
Modified: src/templates.c 3 lines changed, 2 insertions(+), 1 deletions(-) =================================================================== @@ -300,10 +300,11 @@ static void on_file_menu_hide(GtkWidget *item) /* reload templates if any file in the templates path is saved */ static void on_document_save(G_GNUC_UNUSED GObject *object, GeanyDocument *doc) { - gchar *path = g_build_filename(app->configdir, GEANY_TEMPLATES_SUBDIR, NULL); + gchar *path;
g_return_if_fail(!EMPTY(doc->real_path));
+ path = g_build_filename(app->configdir, GEANY_TEMPLATES_SUBDIR, NULL); if (strncmp(doc->real_path, path, strlen(path)) == 0) { /* reload templates */
Modified: src/utils.c 6 lines changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -1966,9 +1966,6 @@ gchar **utils_copy_environment(const gchar **exclude_vars, const gchar *first_va const gchar *key, *value; guint n, o;
- /* get all the environ variables */ - env = g_listenv(); - /* count the additional variables */ va_start(args, first_varname); for (o = 1; va_arg(args, gchar*) != NULL; o++); @@ -1978,6 +1975,9 @@ gchar **utils_copy_environment(const gchar **exclude_vars, const gchar *first_va
o /= 2;
+ /* get all the environ variables */ + env = g_listenv(); + /* create an array large enough to hold the new environment */ n = g_strv_length(env); /* 'n + o + 1' could leak a little bit when exclude_vars is set */
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).