Skip to content

Documentation for 'efi_get_variable' does not mention ownership of the returned 'data' pointer #277

@przemn

Description

@przemn

int efi_get_variable(efi_guid_t guid, const char *name,
void **data, ssize_t *data_size,
uint32_t *attributes);

Documentation for efi_get_variable says only:
"gets the variable specified by guid and name. The value is stored in data, its size in data_size, and its attributes are stored in attributes."

It doesn't say who is the owner of the pointer returned in 'data'.

When you look at the implementation it is clear that the caller should free the memory.
The tests (src/test/tester.c) have an example for usage of 'efi_get_variable' and in that example the memory is freed after the call.

This should be specified so that users can avoid unintentional memory leaks.
Please add a proper sentence to the description.

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