Skip to content

Commit 9c88553

Browse files
committed
- Fix #55301 (mssql part) check if malloc succeded
1 parent 61780c3 commit 9c88553

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/mssql/php_mssql.c

+7
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)