From d14932058f191de2a812a9b3b9ad87c5febd2b3e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 18 Sep 2012 19:51:48 -0400 Subject: Fix some of the problems reported by cppcheck Thanks to Christian for running the static code analysis tool against subsurface... There were some false positives, a few style issues that I'll ignore for now, and two actual potential bugs. First: Don't check unsigned variables for < 0 This has been around for a while and we are lucky that while technically a bug it still works as expected. Passing a negative idx simply turns it into a very large unsigned integer which then fails the > dive_table.nr test. So it still gets a NULL returned. A bug? Yes. Critical? No. Mismatched allocation and free This is an actual bug that potentially could cause issues. We allocate memory with malloc and free it with g_free. Not good. Reported-by: Cristian Ionescu-Idbohrn Signed-off-by: Dirk Hohndel --- gtk-gui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gtk-gui.c') diff --git a/gtk-gui.c b/gtk-gui.c index d797b8d56..167517ebe 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -226,7 +226,7 @@ static gboolean ask_save_changes() "You have unsaved changes to file: %s \nWould you like to save those before closing the datafile?", existing_filename); label = gtk_label_new (label_text); - g_free(label_text); + free(label_text); } gtk_container_add (GTK_CONTAINER (content), label); gtk_widget_show_all (dialog); -- cgit v1.2.3-70-g09d2