[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] [PATCH] Fix some clang-analyzer warnings
From: |
Tim Rühsen |
Subject: |
Re: [Bug-wget] [PATCH] Fix some clang-analyzer warnings |
Date: |
Tue, 18 Nov 2014 21:57:03 +0100 |
User-agent: |
KMail/4.14.2 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) |
Am Dienstag, 18. November 2014, 21:07:41 schrieb Giuseppe Scrivano:
> Tim Rühsen <address@hidden> writes:
> > Fixes these warnings:
> > gnutls.c:457:3: warning: Value stored to 'err' is never read
> >
> > err = 0;
> >
> > http-ntlm.c:477:5: warning: Value stored to 'size' is never read
> >
> > size = (size_t) snprintf (ntlmbuf, sizeof(ntlmbuf),
> >
> > http.c:1479:3: warning: Attempt to free released memory
> >
> > xfree_null (hs->error);
> >
> > The last one *might* result in a crash under special circumstances.
> >
> >
> > I think we should just have one xfree() macro instead of two (xfree and
> > xfree_null, some parts of the code even use free() directly).
> >
> > IMHO, a free'd pointer should always be set to NULL afterwards (as a good
> > programming convention). I suggest the following macro
> >
> > #define xfree(a) do { if (a) { free ((void *) (a)); a = NULL; } } while
> > (0)
>
> I think you can skip the check, gnulib ensures that free(NULL) is a
> no-op.
>
> ACK to the patch.
Pushed.
Tim
signature.asc
Description: This is a digitally signed message part.