[freetds] dbstring_free memory leak

Edward Quackenbush EdwardQuackenbush at symantec.com
Thu Jan 29 16:28:21 EST 2004


I encountered a memory leak when repeatedly opening and closing a 
conection using the DB-lib interface.  It appears that the dbstring_free 
function in dblib.c does not free the string.  The following patch should 
correct this issue. 
eq 

--- ../freetds-0.62.1/src/dblib/dblib.c Fri Dec 26 18:11:08 2003 
+++ ../freetds-0.62.1-werking/src/dblib/dblib.c Thu Jan 29 20:18:18 2004 
@@ -737,9 +737,6 @@ 
                if ((*dbstrp)->strnext != NULL) { 
                        dbstring_free(&((*dbstrp)->strnext)); 
                } 
+               if ((*dbstrp)->strtext != NULL) { 
+                       free((*dbstrp)->strtext); 
+               } 
                free(*dbstrp); 
                *dbstrp = NULL; 
        }



More information about the FreeTDS mailing list