File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -394,9 +394,7 @@ ArrowTable SOMAArray::get_enumeration_values(
394394std::pair<ArrowArray*, ArrowSchema*>
395395SOMAArray::get_enumeration_values_for_column (std::string column_name) {
396396 // This will throw if column name is not found
397- std::unique_ptr<ArrowSchema> up_column_schema = arrow_schema_for_column (
398- column_name);
399- ArrowSchema* column_schema = up_column_schema.get ();
397+ ArrowSchema* column_schema = arrow_schema_for_column (column_name);
400398
401399 // Throw if this column is not of dictionary type
402400 if (column_schema->dictionary == nullptr ) {
@@ -406,6 +404,18 @@ SOMAArray::get_enumeration_values_for_column(std::string column_name) {
406404 column_name));
407405 }
408406
407+ // Release the pointers within the ArrowSchema*:
408+ column_schema->release (column_schema);
409+ // Release the ArrowSchema* itself.
410+ // We are needing to remember that this was allocated by malloc via
411+ // (as of this writing)
412+ // * SOMAArray::arrow_schema_for_column
413+ // * SOMAAttribute::arrow_schema_slot(
414+ // * ArrowAdapter::arrow_schema_from_tiledb_attribute
415+ // Follow-up audits are tracked on
416+ // https://github.com/single-cell-data/TileDB-SOMA/issues/3860
417+ free (column_schema);
418+
409419 Enumeration core_enum = get_existing_enumeration_for_column (column_name);
410420 auto value_dtype = core_enum.type ();
411421
Original file line number Diff line number Diff line change @@ -308,12 +308,10 @@ class SOMAArray : public SOMAObject {
308308 return schema;
309309 }
310310
311- std::unique_ptr<ArrowSchema> arrow_schema_for_column (
312- std::string column_name) const {
311+ ArrowSchema* arrow_schema_for_column (std::string column_name) const {
313312 for (size_t i = 0 ; i < columns_.size (); ++i) {
314313 if (columns_[i]->name () == column_name) {
315- return std::unique_ptr<ArrowSchema>(
316- columns_[i]->arrow_schema_slot (*ctx_, *arr_));
314+ return columns_[i]->arrow_schema_slot (*ctx_, *arr_);
317315 }
318316 }
319317 throw TileDBSOMAError (
You can’t perform that action at this time.
0 commit comments