X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 	tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SARE_MSGID_LONG45,TW_CP,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4BCD9E4E.9050309@gmail.com>
References: <20100419211600.197240@gmx.net> <4BCD9E4E.9050309@gmail.com>
Date: Tue, 20 Apr 2010 16:06:59 +0200
Received: by 10.213.40.201 with SMTP id l9mr3527605ebe.28.1271772419855; Tue,  	20 Apr 2010 07:06:59 -0700 (PDT)
Message-ID: <z2p1ef5a52f1004200706oa8257a94x92665bcc653d3cd6@mail.gmail.com>
Subject: Re: cppcheck bugs
From: Csaba Raduly <rcsaba@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Tue, Apr 20, 2010 at 2:30 PM, Dave Korn  wrote:
> On 19/04/2010 22:16, Martin Ettl wrote:
>> I used cppcheck
>> [../machine/mips/strncpy.c:205]
>
> =A0Uhh, why is it telling us about the MIPS-only version of strncpy in ne=
wlib
> that we don't even compile in?
>

AIUI, that's because cppcheck tries every possible combination of
macros. Unfortunately, there doesn't seem to be a way to specify that
a certain macro is always defined/never defined (i.e. check just one
combination). For example, in our software we have #defines like
WIN32, LINUX, SOLARIS, etc where only one can be defined at any one
time. cppcheck tries every possible value and (when there are other
macros) usually gives up because of too many different combinations.

>> [../../../winsup/utils/cygcheck.cc:1161]: (Error) Mismatching allocation=
 and deallocation: f
>> [../../../winsup/utils/cygcheck.cc:1168]: (Error) Mismatching allocation=
 and deallocation: f
>> [../../../winsup/utils/cygcheck.cc:1159]: (Error) Resource leak: f

If that's dump_sysinfo_services(), then the usage looks indeed suspect to m=
e.


  if ((f =3D popen (buf, "rt")) =3D=3D NULL)
      return;
  if (ferror (f) || feof (f) || ret =3D=3D EOF || maj < 1 || min < 10)
      return; ////////// pclose is not called after successful popen, line =
1159
  fclose (f); ////////// shouldn't this be pclose ? line 1161

  if ((f =3D popen (buf, "rt")) =3D=3D NULL) // line 1168 looks consistent =
with below
      return;

  if (verbose)
      pclose (f);
  else
    {
      pclose (f);

      if (nchars > 0)
        for (char *srv =3D strtok (buf, "\n"); srv; srv =3D strtok (NULL, "=
\n"))
          {
            if ((f =3D popen (buf2, "rt")) =3D=3D NULL)
                return;

            pclose (f);
          }
      else
        no_services =3D true;
    }



>> [../../../winsup/cygwin/child_info.h:65]: (Error) Class child_info which=
 is inherited by class child_info_spawn does not have a virtual destructor
>
> =A0Pretty sure it's meant to be that way for a reason.

Should not be an issue unless a derived-class object is freed through
a base-class pointer.


--=20
Life is complex, with real and imaginary parts.
"OK, it boots. Which means it must be bug-free and perfect. " -- Linus Torv=
alds
"People disagree with me. I just ignore them." -- Linus Torvalds

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

