Skip to content

Commit fe6f0ff

Browse files
committed
fix memory leak with XML from db2_result
1 parent 0aafa2d commit fe6f0ff

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ibm_db2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6072,12 +6072,15 @@ PHP_FUNCTION(db2_result)
60726072
rc = _php_db2_get_data(stmt_res, col_num+1, lob_bind_type, out_char_ptr+1, in_length, &out_length);
60736073
out_char_ptr[0] = i5oshack;
60746074
if ( rc == SQL_ERROR ) {
6075+
efree(out_ptr);
60756076
RETURN_FALSE;
60766077
}
60776078
if (out_length == SQL_NULL_DATA) {
6079+
efree(out_ptr);
60786080
RETURN_NULL();
60796081
}
60806082
RETVAL_STRINGL((char*)out_char_ptr,out_length);
6083+
efree(out_char_ptr);
60816084
#else /* not PASE */
60826085
rc = _php_db2_get_data(stmt_res, col_num+1, SQL_C_BINARY, NULL, 0, (SQLINTEGER *)&in_length);
60836086
if ( rc == SQL_ERROR ) {
@@ -6093,9 +6096,11 @@ PHP_FUNCTION(db2_result)
60936096
}
60946097
rc = _php_db2_get_data(stmt_res, col_num+1, SQL_C_BINARY, (SQLPOINTER)out_ptr, in_length, &out_length);
60956098
if (rc == SQL_ERROR) {
6099+
efree(out_ptr);
60966100
RETURN_FALSE;
60976101
}
60986102
RETVAL_STRINGL((char*)out_ptr,out_length);
6103+
efree(out_ptr);
60996104
#endif /* not PASE */
61006105
break;
61016106

0 commit comments

Comments
 (0)