Skip to content

Commit a5ccc7b

Browse files
committed
Frees in db2_result
1 parent 9abcc9a commit a5ccc7b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ibm_db2.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5907,6 +5907,7 @@ PHP_FUNCTION(db2_result)
59075907
rc = _php_db2_get_data(stmt_res, col_num+1, SQL_C_CHAR, out_ptr, in_length, &out_length);
59085908
#endif
59095909
if ( rc == SQL_ERROR ) {
5910+
efree(out_ptr);
59105911
RETURN_FALSE;
59115912
}
59125913
if (out_length == SQL_NULL_DATA) {
@@ -5982,8 +5983,10 @@ PHP_FUNCTION(db2_result)
59825983
rc = _php_db2_get_data2(stmt_res, col_num+1, SQL_C_CHAR, (void*)out_char_ptr, in_length, in_length+1, &out_length);
59835984
if (rc == SQL_ERROR) {
59845985
RETURN_FALSE;
5986+
efree(out_char_ptr);
59855987
}
5986-
RETURN_STRINGL(out_char_ptr, out_length);
5988+
RETVAL_STRINGL(out_char_ptr, out_length);
5989+
efree(out_char_ptr);
59875990
break;
59885991
case SQL_BLOB:
59895992
case SQL_BINARY:
@@ -6043,9 +6046,11 @@ PHP_FUNCTION(db2_result)
60436046
}
60446047
rc = _php_db2_get_data2(stmt_res, col_num+1, lob_bind_type, (char *)out_ptr, in_length, in_length, &out_length);
60456048
if (rc == SQL_ERROR) {
6049+
efree(out_ptr);
60466050
RETURN_FALSE;
60476051
}
60486052
RETVAL_STRINGL((char*)out_ptr,out_length);
6053+
efree(out_ptr);
60496054
default:
60506055
break;
60516056
}

0 commit comments

Comments
 (0)