1
0
mirror of https://github.com/php/php-src.git synced 2026-04-12 10:33:11 +02:00

Corrected memory leak in read().

This commit is contained in:
Chris Vandomelen
2000-09-14 21:48:15 +00:00
parent 0e874a094c
commit d3ca6394eb

View File

@@ -602,11 +602,14 @@ PHP_FUNCTION(read)
ret = read(Z_LVAL_PP(fd), tmpbuf, Z_LVAL_PP(length));
if (ret >= 0) {
Z_STRVAL_PP(buf) = tmpbuf;
Z_STRVAL_PP(buf) = estrndup(tmpbuf,strlen(tmpbuf));
Z_STRLEN_PP(buf) = ret;
efree(tmpbuf);
RETURN_LONG(ret);
} else {
efree(tmpbuf);
RETURN_LONG(-errno);
}
}