Skip to content

Commit 9a31f29

Browse files
author
pajoye
committed
- Fix #55301 (mssql part) check if malloc succeded
git-svn-id: http://svn.php.net/repository/php/php-src/trunk@313835 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent 2a4aaa3 commit 9a31f29

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/mssql/php_mssql.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,13 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
685685

686686
/* hash it up */
687687
mssql_ptr = (mssql_link *) malloc(sizeof(mssql_link));
688+
if (!mssql_ptr) {
689+
efree(hashed_details);
690+
dbfreelogin(mssql.login);
691+
dbclose(mssql.link);
692+
RETURN_FALSE;
693+
}
694+
688695
memcpy(mssql_ptr, &mssql, sizeof(mssql_link));
689696
Z_TYPE(new_le) = le_plink;
690697
new_le.ptr = mssql_ptr;

0 commit comments

Comments
 (0)