[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] com =?UTF-8?Q?pecl/database/pdo=5Fibm=3A=20Re-allocate=20the=20buffer=20i?= =?UTF-8?Q?nst
From: Calvin Buckley <calvinb () php ! net>
Date: 2020-12-16 19:48:25
Message-ID: php-mail-e92a25b68e181e7f6c489599d6d637b6261938389 () git ! php ! net
[Download RAW message or body]
Commit: 64747ea96aa1c55b02e52ceffd4892454cd38207
Author: Calvin Buckley <calvin@cmpct.info> Wed, 16 Dec 2020 14:48:25 -0500
Parents: 57f6d0ebcc7f75a5ae4e94a6152cc4888b14ab69
Branches: master
Link: http://git.php.net/?p=pecl/database/pdo_ibm.git;a=commitdiff;h=64747ea96aa1c55b02e52ceffd4892454cd38207
Log:
Re-allocate the buffer instead of blindly allocating a new one for LOBs
Otherwise, the old buffer doesn't get freed. Fixes a memory leak
with LOBs.
Changed paths:
M ibm_statement.c
Diff:
diff --git a/ibm_statement.c b/ibm_statement.c
index 99a7989..c304400 100644
--- a/ibm_statement.c
+++ b/ibm_statement.c
@@ -144,7 +144,11 @@ STREAM_RETURN_TYPE lob_stream_read(php_stream *stream, char \
*buf, size_t count) if (buf == NULL) {
rc = get_lob_length(stmt, col_res);
if (rc != SQL_ERROR && col_res->lob_data_length > 0) {
- col_res->lob_data = emalloc(col_res->lob_data_length+1);
+ if (col_res->lob_data) {
+ col_res->lob_data = erealloc(col_res->lob_data, col_res->lob_data_length+1);
+ } else {
+ col_res->lob_data = emalloc(col_res->lob_data_length+1);
+ }
rc = get_lob_substring(stmt, col_res, ctype, &readBytes);
}
} else {
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic