Permalink
Browse files

- Fix #55301 (mssql part) check if malloc succeded

  • Loading branch information...
pierrejoye committed Jul 28, 2011
1 parent 5703457 commit 7cf389ad2c7a7300ab7b582341f56bf496c1a8fe
Showing with 7 additions and 0 deletions.
  1. +7 −0 ext/mssql/php_mssql.c
View
@@ -685,6 +685,13 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* hash it up */
mssql_ptr = (mssql_link *) malloc(sizeof(mssql_link));
+ if (!mssql_ptr) {
+ efree(hashed_details);
+ dbfreelogin(mssql.login);
+ dbclose(mssql.link);
+ RETURN_FALSE;
+ }
+
memcpy(mssql_ptr, &mssql, sizeof(mssql_link));
Z_TYPE(new_le) = le_plink;
new_le.ptr = mssql_ptr;

0 comments on commit 7cf389a

Please sign in to comment.