[Devel] db free_rows and pkg_free

Norman Brandinger norm at goes.com
Tue May 8 16:14:44 CEST 2007


Hi,

I haven't reviewed the code recently (busy with the CALEA deadline on 
May 14). 

If I recall correctly, you might want to look at how the data is stored 
per row.  For example, int is stored directly into the structure while 
only a pointer (char *) to strings is stored.  Before the structure is 
freed, the string (pointed to by the char *) must be freed or a memory 
leak will happen.

The above is applicable to PostgreSQL, I'm not sure how MySQL handles this.

Regards,
Norm

p.s. feel free to contact me off the list if you have any more detailed 
questions about this area of code.


Henning Westerholt wrote:
> Hello,
>
> i'm currently working on cleanup of the db interface, at the moment on the 
> free_row and free_rows functions. I have one question regarding 
> the "free_row" function:
>
> The unixodbc and mysql modules simple call pgk_free on ROW_VALUES(db_row *). 
> The postgresql module loops in the "pg_free_rows" function through each 
> collumn, and frees only DB_STRING values, according the comments to prevent 
> memory leaks.
>
> Which behaviour is correct, or if booth, what should i choose for the generic 
> implementation? 
>
> Thank you,
>
> Henning
>
> _______________________________________________
> Devel mailing list
> Devel at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/devel
>
>
>   




More information about the Devel mailing list