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

clang scan-build reports "Dead nested assignment" & "Memory leak" #271

Open
pabs3 opened this issue Oct 7, 2019 · 5 comments

Comments

@pabs3
Copy link
Contributor

@pabs3 pabs3 commented Oct 7, 2019

With the latest git master, LLVM's scan-build make -j4 reports a couple of warnings:

libdiscord.c:4261:29: warning: Although the value stored to 'read_len' is used in the enclosing expression, the value is never actually read from 'read_len'
                while (nlbr_count < 4 && (read_len = purple_ssl_read(conn, &nextchar, 1)) == 1) {
                                          ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libdiscord.c:5556:4: warning: Potential leak of memory pointed to by 'msg'
                        g_free(postdata);
                        ^~~~~~~~~~~~~~~~
@pabs3

This comment has been minimized.

Copy link
Contributor Author

@pabs3 pabs3 commented Oct 7, 2019

Please note that the first warning is only shown with LLVM 10.

@EionRobb

This comment has been minimized.

Copy link
Owner

@EionRobb EionRobb commented Oct 7, 2019

Is there any comment or anything that can be added to disable the warning for the potential leak of memory? This is a false positive (it's free'd in the purple_message_destroy in the callback in discord_created_direct_message_send())

@EionRobb

This comment has been minimized.

Copy link
Owner

@EionRobb EionRobb commented Oct 7, 2019

Actually, the first one looks like a false-positive to me too? The read_len is used later on down the function?

@pabs3

This comment has been minimized.

Copy link
Contributor Author

@pabs3 pabs3 commented Oct 8, 2019

@pabs3

This comment has been minimized.

Copy link
Contributor Author

@pabs3 pabs3 commented Oct 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.