Fix errors detected by scan-build #2098

wants to merge 7 commits into


None yet
2 participants

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;

jay Nov 20, 2017


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


jay Nov 20, 2017


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


bagder Nov 21, 2017


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

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