[squid-dev] [PATCH] Coverity fixes, part 3

Amos Jeffries squid3 at treenet.co.nz
Sun Jul 26 19:33:28 UTC 2015


On 27/07/2015 4:48 a.m., Kinkie wrote:
> HI,
>   the low-hanging fruits from Coverity's analysis have been picked, now
> working on somewhat more complex fixes.
>
> The attached patch takes a hint from two benign coverity defects to:
> - rework the berEncodeLoginData error handling path to be more readable


in helpers/digest_auth/eDirectory/edir_ldapext.cc:

* please use if (!requestBer) instead of == NULL.
- its the general usage and avoids nullptr conversion later.

* also moving the requestBer declaration to its position of first use.
(before that if)

* instead of local variables elsewhere we commonly use the style:
if (function(...) < 0) { error handling }
- its shorter in the commonly repeated code pattern, and avoids managing
extra local variables.

+1. Please polish and apply just the helper/ changes with the helper
name as prefix to the commit message, like so: "digest_edirectory_auth:
refactor ...".
That way its clearly just a helper change.

I'll use another mail to followup on the src/ bits.

Amos



More information about the squid-dev mailing list