Skip to content

Commit e1f4c56

Browse files
committed
PHPC-222: WriteConcernError can cause segfaults on Ubuntu Precise 32bit
1 parent 047de42 commit e1f4c56

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/MongoDB/WriteConcernError.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ zend_object_value php_phongo_writeconcernerror_create_object(zend_class_entry *c
154154
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_writeconcernerror_free_object, NULL TSRMLS_CC);
155155
retval.handlers = &php_phongo_handler_writeconcernerror;
156156

157+
intern->info = NULL;
158+
157159
return retval;
158160
} /* }}} */
159161

src/MongoDB/WriteError.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ static void php_phongo_writeerror_free_object(void *object TSRMLS_DC) /* {{{ */
156156
if (intern->message) {
157157
efree(intern->message);
158158
}
159+
160+
if (intern->info) {
161+
zval_ptr_dtor(&intern->info);
162+
}
163+
159164
efree(intern);
160165
} /* }}} */
161166

@@ -172,6 +177,8 @@ zend_object_value php_phongo_writeerror_create_object(zend_class_entry *class_ty
172177
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_writeerror_free_object, NULL TSRMLS_CC);
173178
retval.handlers = &php_phongo_handler_writeerror;
174179

180+
intern->info = NULL;
181+
175182
return retval;
176183
} /* }}} */
177184

0 commit comments

Comments
 (0)