@@ -1952,8 +1952,13 @@ MYSQL *mysql_dr_connect(
1952
1952
/*
1953
1953
sock was allocated with mysql_init()
1954
1954
fixes: https://rt.cpan.org/Ticket/Display.html?id=86153
1955
- */
1955
+
1956
1956
Safefree(sock);
1957
+
1958
+ rurban: No, we still need this handle later in mysql_dr_error().
1959
+ RT #97625. It will be freed as imp_dbh->pmysql in dbd_db_destroy(),
1960
+ which is called by the DESTROY handler.
1961
+ */
1957
1962
}
1958
1963
return result ;
1959
1964
}
@@ -1990,6 +1995,7 @@ static int my_login(pTHX_ SV* dbh, imp_dbh_t *imp_dbh)
1990
1995
char * user ;
1991
1996
char * password ;
1992
1997
char * mysql_socket ;
1998
+ int result ;
1993
1999
D_imp_xxh (dbh );
1994
2000
1995
2001
/* TODO- resolve this so that it is set only if DBI is 1.607 */
@@ -2040,8 +2046,11 @@ static int my_login(pTHX_ SV* dbh, imp_dbh_t *imp_dbh)
2040
2046
if (!imp_dbh -> pmysql ) {
2041
2047
Newz (908 , imp_dbh -> pmysql , 1 , MYSQL );
2042
2048
}
2043
- return mysql_dr_connect (dbh , imp_dbh -> pmysql , mysql_socket , host , port , user ,
2049
+ result = mysql_dr_connect (dbh , imp_dbh -> pmysql , mysql_socket , host , port , user ,
2044
2050
password , dbname , imp_dbh ) ? TRUE : FALSE;
2051
+ if (!result )
2052
+ Safefree (imp_dbh -> pmysql );
2053
+ return result ;
2045
2054
}
2046
2055
2047
2056
@@ -3314,7 +3323,8 @@ my_ulonglong mysql_st_internal_execute(
3314
3323
}
3315
3324
#endif
3316
3325
3317
- Safefree (salloc );
3326
+ if (salloc )
3327
+ Safefree (salloc );
3318
3328
3319
3329
if (rows == -2 ) {
3320
3330
do_error (h , mysql_errno (svsock ), mysql_error (svsock ),
0 commit comments