Re: Still some Memory leaks using Informix SE 5.0
Posted in 1995
Roger Flattin wrote: > But we still have a remaining memory leak of 64 bytes > struct SQLDA *q_desc; [...] > EXEC SQL describe sqlobj into q_desc; > if(sqlca.sqlcode<0) my_handle_error(); The problem is the describe statement. It allocates memory for the column information but it is not asocciated with the sqlobj - indeed you can describe that sqlobj any number of times. When you free the sqlobj the memory for the describe area is not freed, you must do it yourself. For Unix ESQL/C use: free (q_desc); In other O/S versions, like ESQL/C for Windoze, there is a specific free function documented in the release notes, SqlFreeMem(). You do not need to free the sqlvar structures as they are part of the sqlda block and are freed with it. You will of course have to deal with any sqlda->sqlvar[].sqldata pointers yourself if you allocated memory for them. Cosmo