Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug hunting #125

Closed
wants to merge 11 commits into from
Closed

Bug hunting #125

wants to merge 11 commits into from

Conversation

scriptum
Copy link
Member

@scriptum scriptum commented Nov 9, 2013

Bugs and leaks found by cppcheck.

@codebrainz
Copy link
Member

It's easier to navigate the commits in G-P if you prefix the commit message with the name of the plugin.

@frlan
Copy link
Member

frlan commented Nov 10, 2013

Can you please rebase the patchset on current HEAD? Some of the patches have been already been addressed.

@scriptum
Copy link
Member Author

Git says that current branch is up to date, isn't? Maybe I fixed some previous fixes (e.g. mismatching allocator/deallocator)?

@frlan
Copy link
Member

frlan commented Nov 10, 2013

My fault. I thought some of the fixes were already in git/master but I was wrong. Sry.

@frlan
Copy link
Member

frlan commented Nov 28, 2013

I have applied the patches for my plugins. Not sure at the moment what I will do with the others.

@@ -114,7 +114,11 @@ static void on_target_browse_clicked(GtkButton *button, gpointer user_data)
if (strcmp(".", prevdir))
strcpy(path, prevdir);
else
strcpy(path, g_path_get_dirname(DOC_FILENAME(document_get_current())));
{
gchar dirname = g_path_get_dirname(DOC_FILENAME(document_get_current()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a gchar*?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@scriptum
Copy link
Member Author

Okay maybe this is a hard to review, but I keep this because I cannot login to SF to leave a bug report and there is no Issues section. ML is a black hole and not suitable as a tracker:)

g_error_free(error); error = NULL;
return success;
}
g_return_val_if_fail(contents, success);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong IMO. The g_return_* functions are for programmer errors. Here, this is a runtime error.
Also, I do not see any benefit of removing the error message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding to documentation on function g_key_file_to_data:

Note that this function never reports an error, so it is safe to pass NULL as error.

So it's ok to remove dead code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, but it's also useless to add the check -- this function never returns NULL either. And as @sardemff7 said, it's kinda weird to use g_return_if_fail() here, which is supposed to be used to check for programming errors like incorrect parameters -- ok, here it checks that g_key_file_to_data() isn't buggy, but huh. IMHO, either leave it as is with the useless error checking, or remote the thing entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants