Skip to content

Commit

Permalink
Fix uninitialized variables (and one leak) in gnome.
Browse files Browse the repository at this point in the history
Found by clang static analyzer.
  • Loading branch information
jralls committed Nov 30, 2018
1 parent 185787d commit f526099
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gnucash/gnome/dialog-print-check.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,7 @@ format_read_general_info(const gchar *file,
static void
free_check_format(check_format_t *data)
{
g_return_if_fail(data);
g_free(data->guid);
g_free(data->filename);
g_free(data->title);
Expand Down Expand Up @@ -1476,7 +1477,7 @@ static void
read_one_check_directory(PrintCheckDialog *pcd, GtkListStore *store,
const gchar *groupname, const gchar *dirname)
{
check_format_t *format, *existing;
check_format_t *format = NULL, *existing;
GDir *dir;
const gchar *filename;
GtkTreeIter iter;
Expand Down
2 changes: 1 addition & 1 deletion gnucash/gnome/dialog-sx-since-last-run.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ variable_value_changed_cb(GtkCellRendererText *cell,
const gchar *value,
GncSxSinceLastRunDialog *dialog)
{
GncSxVariable *var;
GncSxVariable *var = NULL;
GncSxInstance *inst;
GtkTreeIter tree_iter;
gnc_numeric parsed_num;
Expand Down
1 change: 1 addition & 0 deletions gnucash/gnome/gnc-plugin-page-account-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ gnc_plugin_page_account_tree_open (Account *account, GtkWindow *win)
else // we have no account pages, create one
plugin_page = gnc_plugin_page_account_tree_new ();

g_return_if_fail(plugin_page);
window = plugin_page->window;

gnc_main_window_open_page (GNC_MAIN_WINDOW(window), plugin_page);
Expand Down
3 changes: 2 additions & 1 deletion gnucash/gnome/gnc-split-reg2.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer user_data)
GNCSplitReg2 *gsr = user_data;
gnc_commodity * commodity;
GNCPrintAmountInfo print_info;
gnc_numeric amount;
gnc_numeric amount = gnc_numeric_zero();
Account *leader;
gboolean reverse;
gboolean euro;
Expand Down Expand Up @@ -976,6 +976,7 @@ gnc_split_reg2_determine_read_only (GNCSplitReg2 *gsr) //this works
{
case PLACEHOLDER_NONE:
/* stay as false. */
g_free (args);
return;

case PLACEHOLDER_THIS:
Expand Down

0 comments on commit f526099

Please sign in to comment.