Commits

Ruslan Osmanov committed 2be1502

Fix: crash due to destruction of the internal bufferevent buffers (synced with oop branch)
Fix: extra memory consumption caused by continuous calls to bufferevent_get_input/_output

Comments (0)

Files changed (2)

 {
 	php_event_buffer_t *b = (php_event_buffer_t *) rsrc->ptr;
 
-	if (b) {
+	if (b && !b->internal) {
 		evbuffer_free(b->buf);
 		efree(b);
 	}
 
 	b->buf       = bufferevent_get_input(bev->bevent);
 	b->rsrc_id   = ZEND_REGISTER_RESOURCE(return_value, b, le_event_buffer);
+	b->internal  = 1;
 
-	zend_list_addref(b->rsrc_id);
+	/*zend_list_addref(b->rsrc_id);*/
 }
 /* }}} */
 
 
 	b->buf       = bufferevent_get_output(bev->bevent);
 	b->rsrc_id   = ZEND_REGISTER_RESOURCE(return_value, b, le_event_buffer);
+	b->internal  = 1;
 
-	zend_list_addref(b->rsrc_id);
+	/*zend_list_addref(b->rsrc_id);*/
 }
 /* }}} */
 
 
 typedef struct {
 	struct evbuffer *buf;
-	int              rsrc_id;   /* Resource ID of the event buffer */
+	int              rsrc_id;    /* Resource ID of the event buffer                */
+	zend_bool        internal;   /* Whether is an internal buffer of a bufferevent */
 } php_event_buffer_t;
 
 #ifdef HAVE_EVENT_EXTRA_LIB/* {{{ */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.