Skip to content

Adafruit_ZeroDMA::addDescriptor returning static pointer #23

@Gentoli

Description

@Gentoli

From

DmacDescriptor *Adafruit_ZeroDMA::addDescriptor(

You'll want to keep the pointer for later if you need to modify or free the descriptor.

Looking at the implementation, &_descriptor[channel] is being return if addDescriptor is first called on a new Adafruit_ZeroDMA object. _descriptor is allocated statically in the .hsram section.
If I understood the code correctly, freeing the pointer returned from the first call to addDescriptor is freeing a non heap ptr which will cause an error.

The description should be updated so the first descriptor will be treated differently thus not freed by accident.
Or with more changes, caller of addDescriptor should be able to treat descriptors returned from it in the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions