Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Thu, 02 May 2024 21:52:06 UTC Commit: fbd308f2e9142c44eb66a83efb01fac3702ef061 https://github.com/geany/geany-plugins/commit/fbd308f2e9142c44eb66a83efb01fa...
Log Message: ----------- cppcheck: Add inline suppressions for false-positives
Modified Paths: -------------- geanyctags/src/geanyctags.c geanygendoc/src/ggd-options.c geniuspaste/src/geniuspaste.c git-changebar/src/gcb-plugin.c scope/src/debug.c vimode/src/cmd-runner.c workbench/src/sidebar.c workbench/src/wb_project.c
Modified: geanyctags/src/geanyctags.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -162,6 +162,8 @@ static void spawn_cmd(const gchar *cmd, const gchar *dir) msgwin_msg_add(COLOR_BLACK, -1, NULL, "%s", out); }
+ /* cppcheck-suppress mismatchAllocDealloc symbolName=argv + * argv is built manually, but is a valid GStrv */ g_strfreev(argv); g_free(working_dir); g_free(out);
Modified: geanygendoc/src/ggd-options.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -202,6 +202,7 @@ ggd_opt_group_add_entry (GgdOptGroup *group,
g_array_append_val (group->prefs, entry);
+ /* cppcheck-suppress memleak symbolName=entry.key */ return &g_array_index (group->prefs, GgdOptEntry, group->prefs->len -1); }
Modified: geniuspaste/src/geniuspaste.c 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -381,6 +381,8 @@ static gchar *pastebin_get_language(const Pastebin *pastebin, gchar *lang = g_key_file_get_string(pastebin->config, PASTEBIN_GROUP_LANGUAGES, geany_ft_name, NULL);
+ /* cppcheck-suppress memleak symbolName=lang + * obvious cppcheck bug */ return lang ? lang : pastebin_get_default(pastebin, "language", ""); }
@@ -752,6 +754,7 @@ static void show_msgbox(GtkMessageType type, GtkButtonsType buttons, gtk_widget_destroy(dlg);
g_free(markup); + /* cppcheck-suppress memleak symbolName=dlg */ }
static void debug_log_message_body(SoupMessage *msg,
Modified: git-changebar/src/gcb-plugin.c 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -566,6 +566,7 @@ get_cached_blob_contents_async (const gchar *path, }
g_async_queue_push (G_queue, job); + /* cppcheck-suppress memleak symbolName=job */ } }
Modified: scope/src/debug.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -207,6 +207,8 @@ static void create_send_source(void) g_source_set_callback(send_source, (GSourceFunc) send_commands_cb, NULL, send_source_destroy_cb); send_source_id = g_source_attach(send_source, NULL); + /* cppcheck-suppress memleak symbolName=send_source + * the source is attached and managed through its ID */ }
#define HAS_SPAWN_LEAVE_STDIN_OPEN 0 @@ -347,6 +349,8 @@ static void gdb_finalize(void) if (send_channel) { g_io_channel_shutdown(send_channel, FALSE, NULL); + /* cppcheck-suppress doubleFree symbolName=send_channel + * erroneously thinks g_io_channel_shutdown() frees the channel */ g_io_channel_unref(send_channel); send_channel = NULL;
Modified: vimode/src/cmd-runner.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -707,6 +707,8 @@ static gboolean process_cmd(CmdDef *cmds, CmdContext *ctx, gboolean ins_mode) } else if (!consumed && ctx->kpl) { + /* cppcheck-suppress deallocuse symbolName=kpl + * Not sure how cppcheck gets this wrong here, but all seem OK */ g_free(ctx->kpl->data); ctx->kpl = g_slist_delete_link(ctx->kpl, ctx->kpl); }
Modified: workbench/src/sidebar.c 6 lines changed, 6 insertions(+), 0 deletions(-) =================================================================== @@ -213,6 +213,8 @@ static void sidebar_create_branch(gint level, const gchar *abs_base_dir, GSList FILEVIEW_COLUMN_ICON, icon_dir, FILEVIEW_COLUMN_NAME, last_dir_name, FILEVIEW_COLUMN_DATA_ID, DATA_ID_SUB_DIRECTORY, + /* cppcheck-suppress leakNoVarFunctionCall + * type is gpointer, but admittedly I don't see where it's freed? */ FILEVIEW_COLUMN_ASSIGNED_DATA_POINTER, g_strdup(full), -1);
@@ -235,6 +237,8 @@ static void sidebar_create_branch(gint level, const gchar *abs_base_dir, GSList FILEVIEW_COLUMN_ICON, icon_dir, FILEVIEW_COLUMN_NAME, last_dir_name, FILEVIEW_COLUMN_DATA_ID, DATA_ID_SUB_DIRECTORY, + /* cppcheck-suppress leakNoVarFunctionCall + * type is gpointer, but admittedly I don't see where it's freed? */ FILEVIEW_COLUMN_ASSIGNED_DATA_POINTER, g_strdup(full), -1); g_free(full); @@ -440,6 +444,8 @@ static void sidebar_add_file (WB_PROJECT *prj, WB_PROJECT_DIR *root, const gchar FILEVIEW_COLUMN_ICON, icon, FILEVIEW_COLUMN_NAME, name, FILEVIEW_COLUMN_DATA_ID, dataid, + /* cppcheck-suppress leakNoVarFunctionCall + * type is gpointer, but admittedly I don't see where it's freed? */ FILEVIEW_COLUMN_ASSIGNED_DATA_POINTER, g_strdup(filepath), -1);
Modified: workbench/src/wb_project.c 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -691,6 +691,7 @@ static guint wb_project_dir_rescan_int(WB_PROJECT *prj, WB_PROJECT_DIR *root)
if (path) { + /* cppcheck-suppress leakNoVarFunctionCall -- key is freed automatically */ g_hash_table_add(root->file_table, g_strdup(path)); filenum++; } @@ -757,6 +758,7 @@ static void wb_project_dir_add_file_int(WB_PROJECT *prj, WB_PROJECT_DIR *root, c }
/* Update file table and counters. */ + /* cppcheck-suppress leakNoVarFunctionCall -- key is freed automatically */ g_hash_table_add(root->file_table, g_strdup(filepath)); if (g_file_test(filepath, G_FILE_TEST_IS_DIR)) { @@ -818,6 +820,7 @@ static void wb_project_dir_update_tags(WB_PROJECT_DIR *root) gchar *locale_path = utils_get_locale_from_utf8(utf8_path);
g_ptr_array_add(files, g_strdup(key)); + /* cppcheck-suppress leakNoVarFunctionCall -- key is freed automatically */ g_hash_table_add(root->file_table, g_strdup(utf8_path)); g_free(locale_path); } @@ -960,6 +963,7 @@ static void wb_project_dir_regenerate_tags(WB_PROJECT_DIR *root, G_GNUC_UNUSED g }
/* Add all files to the file-table (files and dirs)! */ + /* cppcheck-suppress leakNoVarFunctionCall -- key is freed automatically */ g_hash_table_add(file_table, g_strdup(key)); } g_hash_table_destroy(root->file_table);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).