List:General Discussion« Previous MessageNext Message »
From:Teresa A Narvaez Date:December 23 2004 9:11pm
Subject:Re: mysql_fetch_lengths()
View as plain text  



Thank you very much for your help!
-Teresa


----------------------------------------------------------------------------------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------




                                                                                          
                   
                      Dan Nelson                                                          
                   
                      <dnelson                 To:      Teresa A Narvaez/FED/CSC@CSC   
                      
                      @allantgroup.com         cc:      mysql@stripped             
                   
                      >                        Subject: Re: mysql_fetch_lengths()      
                      
                                                                                          
                   
                      12/23/2004 02:14                                                    
                   
                      PM                                                                  
                   
                                                                                          
                   
                                                                                          
                   




In the last episode (Dec 23), Teresa A Narvaez said:
> > Dan wrote:
> > In the last episode (Dec 23), Teresa A Narvaez said:
> > > We were running mysql 3.22.30 on an Tru 64 Alpha server OSF 4.0F.
> > > We recently upgraded to mysql 3.23.58 on the same server.
> > >
> > > In the code fragment below, there is a memory leak at line 8
> > > because mysql_fetch_lenghts returns an array of unsigned long
> > > integers representing the size of each column.  So, has the retun
> > > value of mysql_fetch_lengths() been the same for mysql 3.22.30
> > > and 3.23.58?
> >
> > The memory allocated at line 8 is freed at line 15.  In fact, it's
> > never used at all.  The array returned by mysql_fetch_lengths is an
> > internal array that is freed by mysql_free_result(); you don't need
> > to allocate it or free it.
>
> Thank you for the response.  I completely agree with your response.
> The reason why I asked this question is because I remember seeing
> len(unsigned long *lengths;) dynamically allocated in the MYSQL
> manual some time ago(when I was running mysql 3.23.30).  So, I wonder
> if there was a change in the return value of mysql_fetch_lenghts() in
> mysql 3.23.58. Otherwise, I made a mistake in dynamically allocating
> memory for len.  I must have misunderstood.

I don't think it has ever required the user to malloc or free the
lengths array.  I checked back as far as 3.20.32, and the
mysql_fetch_lengths function is identical to 3.23.58, except for the
change from int* to long*.

--
             Dan Nelson
             dnelson@stripped

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1




Thread
mysql_fetch_lengths()Teresa A Narvaez23 Dec
  • Re: mysql_fetch_lengths()Dan Nelson23 Dec
Re: mysql_fetch_lengths()Teresa A Narvaez23 Dec
  • Re: mysql_fetch_lengths()Dan Nelson23 Dec
Re: mysql_fetch_lengths()Teresa A Narvaez23 Dec