projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- fix remaining issues; there's still a 1-byte memleak I could not find yet
[m6w6/ext-http]
/
phpstr
/
phpstr.c
diff --git
a/phpstr/phpstr.c
b/phpstr/phpstr.c
index 3e8e311ee464246e24ce0e9383e79039b46cf488..45c9e2632bb6293a10765d59f6dd941e598b4335 100644
(file)
--- a/
phpstr/phpstr.c
+++ b/
phpstr/phpstr.c
@@
-4,7
+4,7
@@
#include "php.h"
#include "phpstr.h"
#include "php.h"
#include "phpstr.h"
-PHPSTR_API phpstr *phpstr_init_ex(phpstr *buf, size_t chunk_size,
zend_bool
pre_alloc)
+PHPSTR_API phpstr *phpstr_init_ex(phpstr *buf, size_t chunk_size,
int
pre_alloc)
{
if (!buf) {
buf = emalloc(sizeof(phpstr));
{
if (!buf) {
buf = emalloc(sizeof(phpstr));
@@
-262,7
+262,7
@@
PHPSTR_API size_t phpstr_chunk_buffer(phpstr **s, const char *data, size_t data_
if (!chunk_size) {
phpstr_data(storage, chunk, &chunk_size);
if (!chunk_size) {
phpstr_data(storage, chunk, &chunk_size);
- phpstr_free(
&storage
);
+ phpstr_free(
s
);
return chunk_size;
}
return chunk_size;
}
@@
-287,6
+287,11
@@
PHPSTR_API void phpstr_chunked_output(phpstr **s, const char *data, size_t data_
efree(chunk);
data = NULL;
data_len = 0;
efree(chunk);
data = NULL;
data_len = 0;
+ if (!chunk_len) {
+ /* we already got the last chunk,
+ and freed all resources */
+ break;
+ }
}
}
}
}