Subject Problem with Prepared statements and malloced arguments
Author Dave Smith

Ok, I'm not sure what is wrong here. I find it difficult to imagine that
this could be a problem.

In my application, I have created and use INSERT prepared statements which
work with no problems when passing variables declared on the stack as
parameters. For example,

char name[500];
name = "Bob";

and then assigning the "name" variable to the sqlvar[0].sqldata variable.

However, if I had it setup this way:

char *name = NULL;
name = (char*)malloc(500);
strcpy(name, "Bob");

and then assign the "name" variable to sqlvar[0].sqldata, the firebird code
crashes. This happens with any malloced item that I assign. However,

char *name = NULL;
name = "Bob";

and assign this to sqlvar[0].sqldata, it works (as "Bob" is a literal and
not malloced).

I don't have problems adding blobs to the database even thought the space
for the data going into the blob is malloced.

Can anyone give me a bit of insight into this? I can try and write a test
application if the need is there.


[Non-text portions of this message have been removed]