Skip to content

Commit 9abcc9a

Browse files
committed
Fix leak with db2_escape_string
Allocation failure should also be handled in a way that fits the func info
1 parent db9dcd7 commit 9abcc9a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ibm_db2.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7240,9 +7240,10 @@ PHP_FUNCTION(db2_escape_string)
72407240

72417241

72427242
/* reallocate to the real length */
7243-
new_str = (char *)realloc(new_str, new_length + 1);
7243+
new_str = (char *)erealloc(new_str, new_length + 1);
72447244

7245-
RETURN_STRINGL(new_str, new_length);
7245+
RETVAL_STRINGL(new_str, new_length);
7246+
efree(new_str);
72467247
}
72477248
/* }}} */
72487249

0 commit comments

Comments
 (0)