Fix errors detected by scan-build #2098

Closed
wants to merge 7 commits into
from

Conversation

Projects
None yet
2 participants
@bagder
Member

bagder commented Nov 20, 2017

I ran scan-build on the code and cleaned up some low hanging fruit. The automated scan-build I run uses a much older clang version and didn't catch any of these!

bagder added some commits Nov 20, 2017

Curl_llist_remove: fix potential NULL pointer deref
Fixes a scan-build warning.

@bagder bagder changed the title from Bagder/scan build fixes to Fix errors detected by scan-build Nov 20, 2017

@@ -722,7 +722,6 @@ static size_t readback_bytes(mime_state *state,
sz = numbytes - state->offset;
if(numbytes > state->offset) {
- sz = numbytes - state->offset;

This comment has been minimized.

@jay

jay Nov 20, 2017

Member

I don't see how this one is right. sz is used later on

@jay

jay Nov 20, 2017

Member

I don't see how this one is right. sz is used later on

This comment has been minimized.

@jay

jay Nov 20, 2017

Member

nm I see it now, it was set above. it would probably be easier to understand if it was set here and the one above removed

@jay

jay Nov 20, 2017

Member

nm I see it now, it was set above. it would probably be easier to understand if it was set here and the one above removed

This comment has been minimized.

@bagder

bagder Nov 21, 2017

Member

Yeah probably, was more thinking that it could benefit of being set unconditionally first so that one wouldn't think it risked ending up not being set...

@bagder

bagder Nov 21, 2017

Member

Yeah probably, was more thinking that it could benefit of being set unconditionally first so that one wouldn't think it risked ending up not being set...

@bagder bagder closed this in 9554c3c Nov 21, 2017

@bagder bagder deleted the bagder/scan-build-fixes branch Nov 21, 2017

@lock lock bot locked as resolved and limited conversation to collaborators May 14, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.