Hello, this is my first attempt to contribute something to GnuCash. Patches are generated against trunk.
Aurimas.
>From f1bd86e151003c3f27ad233e90f12a041f2b5609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aurimas=20Fi=C5=A1eras?= <[email protected]> Date: Sun, 21 Aug 2011 14:20:48 +0300 Subject: (cppcheck) fix two possible memory leaks --- src/gnome-utils/gnc-main-window.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index ee13ee0..bb64447 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -1927,6 +1927,8 @@ main_window_update_page_name (GncPluginPage *page, window = GNC_MAIN_WINDOW(page->window); if (!window) { + g_free(old_page_name); + g_free(old_page_long_name); LEAVE("no window widget available"); return; } -- 1.7.5.4
>From 82c71953c33aedb9f9e472c4700cbaf81aea1f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aurimas=20Fi=C5=A1eras?= <[email protected]> Date: Sun, 21 Aug 2011 13:57:56 +0300 Subject: (cppcheck) Fix "error: Memory leak: bufp" --- src/experimental/cgi-bin/fastcgi-hello.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/experimental/cgi-bin/fastcgi-hello.c b/src/experimental/cgi-bin/fastcgi-hello.c index eddd673..4ab060c 100644 --- a/src/experimental/cgi-bin/fastcgi-hello.c +++ b/src/experimental/cgi-bin/fastcgi-hello.c @@ -46,6 +46,7 @@ int main (int argc, char *argv[]) fread (bufp, ilen, 1, stdin); printf ("The POST data is<P>%s\n", bufp); + free (bufp); } } -- 1.7.5.4
>From 5b82d4d29b332356b889a98508fe77c542147d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aurimas=20Fi=C5=A1eras?= <[email protected]> Date: Sun, 21 Aug 2011 13:53:36 +0300 Subject: (cppcheck) Fix a possible memory leak --- src/engine/test-core/test-engine-stuff.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/engine/test-core/test-engine-stuff.c b/src/engine/test-core/test-engine-stuff.c index 6c132c5..6974941 100644 --- a/src/engine/test-core/test-engine-stuff.c +++ b/src/engine/test-core/test-engine-stuff.c @@ -1436,7 +1436,6 @@ get_random_transaction_with_currency(QofBook *book, gint num; gchar *numstr; - numstr = g_new0(gchar, 10); if (!account_list) { account_list = gnc_account_get_descendants (gnc_book_get_root_account (book)); @@ -1450,6 +1449,8 @@ get_random_transaction_with_currency(QofBook *book, return NULL; } + numstr = g_new0(gchar, 10); + trans = xaccMallocTransaction(book); xaccTransBeginEdit(trans); -- 1.7.5.4
>From 8923183693a2b063b0ab8c45db6324e1dd6301a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aurimas=20Fi=C5=A1eras?= <[email protected]> Date: Sun, 21 Aug 2011 12:08:20 +0300 Subject: (cppcheck) Remove redundant null check --- src/engine/SX-book.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/engine/SX-book.c b/src/engine/SX-book.c index 5173121..57ee618 100644 --- a/src/engine/SX-book.c +++ b/src/engine/SX-book.c @@ -302,7 +302,7 @@ book_sxlist_notsaved(const QofCollection *col) sxl = gnc_collection_get_schedxactions(col); if (!sxl) return FALSE; - if ((sxl && sxl->sx_notsaved)) return TRUE; + if (sxl->sx_notsaved) return TRUE; for (sxlist = sxl->sx_list; sxlist != NULL; -- 1.7.5.4
>From c514d9c943b085ccf33061d13512c70f39f11d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aurimas=20Fi=C5=A1eras?= <[email protected]> Date: Sun, 21 Aug 2011 11:57:08 +0300 Subject: (cppcheck) Fix "error: Memory leak: gea" --- src/backend/xml/io-example-account.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/backend/xml/io-example-account.c b/src/backend/xml/io-example-account.c index 435023f..75bbe40 100644 --- a/src/backend/xml/io-example-account.c +++ b/src/backend/xml/io-example-account.c @@ -334,6 +334,7 @@ gnc_read_example_account(const gchar *filename) GNC_ACCOUNT_STRING, main_parser, NULL, NULL)) { + gnc_destroy_example_account(gea); return FALSE; } @@ -347,6 +348,7 @@ gnc_read_example_account(const gchar *filename) "gnc:account", gnc_account_sixtp_parser_create(), NULL, NULL)) { + gnc_destroy_example_account(gea); return FALSE; } @@ -355,6 +357,7 @@ gnc_read_example_account(const gchar *filename) { sixtp_destroy(top_parser); xaccLogEnable (); + gnc_destroy_example_account(gea); return FALSE; } -- 1.7.5.4
>From cf999aceedf7b45f86af5448ba3222deeb06dcd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aurimas=20Fi=C5=A1eras?= <[email protected]> Date: Sun, 21 Aug 2011 11:37:12 +0300 Subject: (cppcheck) Fix "error: Memory leak: msg" --- src/app-utils/gfec.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app-utils/gfec.c b/src/app-utils/gfec.c index e7eb704..de7a853 100644 --- a/src/app-utils/gfec.c +++ b/src/app-utils/gfec.c @@ -29,7 +29,7 @@ gfec_catcher(void *data, SCM tag, SCM throw_args) { SCM func; SCM result; - const char *msg = NULL; + char *msg = NULL; func = scm_c_eval_string("gnc:error->string"); if (scm_is_procedure(func)) @@ -49,10 +49,13 @@ gfec_catcher(void *data, SCM tag, SCM throw_args) if (msg == NULL) { - msg = "Error running guile function."; + *(char**)data = strdup("Error running guile function."); + } + else + { + *(char**)data = strdup(msg); + g_free(msg); } - - *(char**)data = strdup(msg); return SCM_UNDEFINED; } -- 1.7.5.4
>From 3cd31b1368e2e047b4ceeeef3b3454ee201b38fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aurimas=20Fi=C5=A1eras?= <[email protected]> Date: Sun, 21 Aug 2011 10:44:16 +0300 Subject: (cppcheck) Fix "error: Mismatching allocation and deallocation: symbol" --- src/app-utils/option-util.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/src/app-utils/option-util.c b/src/app-utils/option-util.c index c27cfcc..52c909b 100644 --- a/src/app-utils/option-util.c +++ b/src/app-utils/option-util.c @@ -2230,8 +2230,7 @@ gnc_option_db_lookup_date_option(GNCOptionDB *odb, *set_rel_value = g_strdup(SCM_SYMBOL_CHARS (relative)); } - if (symbol) - free (symbol); + g_free (symbol); } } } -- 1.7.5.4
_______________________________________________ gnucash-devel mailing list [email protected] https://lists.gnucash.org/mailman/listinfo/gnucash-devel
