mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-12-23 06:29:49 +01:00
formatutils: ensure we dont leak name ptr (#2)
store format name in a std::string and free the char ptr to ensure we dont leak on each call to drmGetFormatName.
This commit is contained in:
parent
c5cf93a3cc
commit
2a3ff6a61d
1 changed files with 4 additions and 2 deletions
|
@ -4,5 +4,7 @@
|
||||||
|
|
||||||
std::string fourccToName(uint32_t drmFormat) {
|
std::string fourccToName(uint32_t drmFormat) {
|
||||||
auto fmt = drmGetFormatName(drmFormat);
|
auto fmt = drmGetFormatName(drmFormat);
|
||||||
return fmt ? fmt : "unknown";
|
std::string name = fmt ? fmt : "unknown";
|
||||||
|
free(fmt);
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue