freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Sebastien FLAESCH <sf AT 4js.com>
- To: freetds AT lists.ibiblio.org
- Subject: Re: [freetds] SQLPutData() with a size of zero
- Date: Tue, 09 Apr 2013 12:23:07 +0200
Version 0.92.556 seems to fix this problem.
Thank you Frediano.
Seb
On 03/11/2013 05:51 PM, James K. Lowden wrote:
On Mon, 11 Mar 2013 16:36:52 +0100
Sebastien FLAESCH<sf AT 4js.com> wrote:
p = (TDS_CHAR *) malloc(len);
}
if (!p) {
odbc_errs_add(&stmt->errs, "HY001",
NULL); /* Memory allocation error */ return SQL_ERROR;
}
and here malloc(0) returns zero (AIX 6.1)...
http://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.basetechref/doc/basetrf1/malloc.htm#malloc
http://pubs.opengroup.org/onlinepubs/009695399/functions/malloc.html
Huh. Learn something new every day. I thought malloc could return
NULL only for failure. But the standard says,
"If size is 0, either a null pointer or a unique pointer that
can be successfully passed to free() shall be returned. "
It looks like you want _LINUX_SOURCE_COMPAT. Either that, or change
the test to
if( len&& !p )
While you're at it, you can remove the casts to to malloc. We got rid
of them once, but they keep regenerating.
Thanks for pointing this out, no pun intended.
--jkl
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
- Re: [freetds] SQLPutData() with a size of zero, Sebastien FLAESCH, 04/09/2013
Archive powered by MHonArc 2.6.24.