[quagga-dev 12878] Re: [PATCH 2/7] Fixed logically dead code in lib/stream.c

nolan nolan at cumulusnetworks.com
Fri Jul 24 22:37:42 BST 2015


Asserts are sometimes compiled out, so the redundant check is necessary. 
  The optimizer will cull it if asserts are enabled, so it doesn't hurt 
the generated code.

On 07/23/2015 06:52 AM, Denil Vira wrote:
> Coverity Scan ID 1302488. Test for size==0 makes no sense, since assert immediately before it
> would not let this code happen.
>
> Signed-off-by: Denil Vira <denil at cumulusnetworks.com>
> ---
>   lib/stream.c | 6 ------
>   1 file changed, 6 deletions(-)
>
> diff --git a/lib/stream.c b/lib/stream.c
> index e13da08..cd256e2 100644
> --- a/lib/stream.c
> +++ b/lib/stream.c
> @@ -93,12 +93,6 @@ stream_new (size_t size)
>
>     assert (size > 0);
>
> -  if (size == 0)
> -    {
> -      zlog_warn ("stream_new(): called with 0 size!");
> -      return NULL;
> -    }
> -
>     s = XCALLOC (MTYPE_STREAM, sizeof (struct stream));
>
>     if (s == NULL)
>





More information about the Quagga-dev mailing list