Skip to Content.
Sympa Menu

freetds - Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen()

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Craig A. Berry" <craigberry AT mac.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen()
  • Date: Mon, 23 Mar 2009 07:19:33 -0500


On Mar 23, 2009, at 6:09 AM, Frediano Ziglio wrote:

2009/3/21 James K. Lowden <jklowden AT freetds.org>:
Craig A. Berry wrote:
if (!(server)) { dbperror(dbproc, 20176, 0, "dbopen", (int) 2);
return (void *)0; };

The check isn't against "random data from the stack"; it's against
the
server argument.

I really wasn't clear (and hadn't looked at the macro long enough to
understand it). It's dbproc, not server, that has been "fetched but
not initialized".
I think that a

DBPROCESS *dbproc = NULL;

is better... so we check parameter and in case server is NULL we call
dbperror with proper DBPROCESS (which is NULL).
I don't understand why gcc don't detect this...


Good question. The docs here:

<http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Warning-Options.html#Warning-Options >

say that -Wall implies -Wuninitialized only when -01 is in effect, and furthermore that -Wuninitialized only works when -O is present because without optimization the compiler doesn't have the necessary information to detect uninitialized values. Not sure if that's the reason for FreeTDS.

________________________________________
Craig A. Berry
mailto:craigberry AT mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser





Archive powered by MHonArc 2.6.24.

Top of Page