I've got a program written for MySQL version 3 (don't ask, long story as to why we haven't upgraded this particular system), compiled using gcc v3.2 on SUSE Linux version 2.4.19-64GB-SMP. I'm getting a segmentation fault when I run using ONE set of input parameters (but not any others).

When I run under valgrind, I get the following error just before the segmentation fault:

==21258== Invalid read of size 4
==21258== at 0x4023BBF7: mysql_fetch_fields (in /usr/lib/libmysqlclient.so.10.0.0)
==21258==    Address 0x10 is not stack'd, malloc'd or free'd


The particular call in the source code is

   fields = mysql_fetch_fields(res);

where fields is defined as

   MYSQL_FIELD  *fields;


Can anyone with more familiarity with the C API internals tell me whether or not mysql_fetch_fields() allocates space for the pointer it returns? This hasn't been an issue in any other programs and my suspicion is that I'm clobbering memory somewhere else (but if it's as simple as me needing to allocate space for the returned pointer, then I'd like to know!)

Thanks.


--
Dave Weingart, Sr. Programmer/Analyst    "I can call modules from the vasty
RNA Private Label Services                deep." -- "Why, so can I, or so can
Voice: +1-516-682-1470                    any programmer.  But will they run
FAX  : +1-516-496-0113                    when you do call for them?"


This e-mail message is for the sole use of the intended recipient(s) and may 
contain confidential and privileged information. Any unauthorized review, use, 
disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply e-mail and destroy all copies of 
the original message.



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to