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

Fix clang static analyzer warning #137

Merged
merged 1 commit into from
May 30, 2018

Conversation

larchunix
Copy link
Contributor

@larchunix larchunix commented May 30, 2018

A possible use of NULL pointer has been identified by clang static analyzer:

../src/util.c:809:8: warning: Null pointer passed as an argument to a 'nonnull' parameter
                        if (strcmp (ver, lver) != 0) {
                            ^~~~~~~~~~~~~~~~~~
1 warning generated.

Add a NULL pointer check to fix the warning.

A possible use of null pointer has been identified by clang static
analyzer:

    ../src/util.c:809:8: warning: Null pointer passed as an argument to a 'nonnull' parameter
                            if (strcmp (ver, lver) != 0) {
                                ^~~~~~~~~~~~~~~~~~
    1 warning generated.

Add a NULL pointer check to fix the warning.
@f2404 f2404 merged commit dca9d1b into archlinuxfr:master May 30, 2018
@f2404
Copy link
Collaborator

f2404 commented May 30, 2018

Merged, thanks!

@larchunix
Copy link
Contributor Author

On second thought, maybe a better fix was to add the check later like this:

if (lver) {
    if (info && strcmp (info, "local") != 0) {
        ....
        if (ver && strcmp (ver, lver) != 0) {
            printf ( ... )
        }
    }
}

@f2404
Copy link
Collaborator

f2404 commented May 30, 2018

Yeah, that would probably be better.

@larchunix
Copy link
Contributor Author

@f2404 would you mind pushing a fix or do you prefer a new PR ?

@f2404
Copy link
Collaborator

f2404 commented May 30, 2018

I can fix it myself. Thanks again!

@larchunix larchunix deleted the clang-analyzer branch May 30, 2018 20:56
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.

2 participants