/* Tests the libesedb_table_free function * Returns 1 if successful or 0 if not */ int esedb_test_table_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libesedb_table_free( NULL, &error ); ESEDB_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); ESEDB_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); }
/* Frees an table object */ void pyesedb_table_free( pyesedb_table_t *pyesedb_table ) { libcerror_error_t *error = NULL; struct _typeobject *ob_type = NULL; static char *function = "pyesedb_table_free"; if( pyesedb_table == NULL ) { PyErr_Format( PyExc_TypeError, "%s: invalid table.", function ); return; } if( pyesedb_table->table == NULL ) { PyErr_Format( PyExc_TypeError, "%s: invalid table - missing libesedb table.", function ); return; } ob_type = Py_TYPE( pyesedb_table ); if( ob_type == NULL ) { PyErr_Format( PyExc_ValueError, "%s: missing ob_type.", function ); return; } if( ob_type->tp_free == NULL ) { PyErr_Format( PyExc_ValueError, "%s: invalid ob_type - missing tp_free.", function ); return; } if( libesedb_table_free( &( pyesedb_table->table ), &error ) != 1 ) { pyesedb_error_raise( error, PyExc_IOError, "%s: unable to free libesedb table.", function ); libcerror_error_free( &error ); } if( pyesedb_table->file_object != NULL ) { Py_DecRef( (PyObject *) pyesedb_table->file_object ); } ob_type->tp_free( (PyObject*) pyesedb_table ); }