Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 20d18966 authored by George Burgess IV's avatar George Burgess IV
Browse files

media: Silence an analyzer complaint; clean up code

The static analyzer is complaining about a memory leak when we create
this unique pointer. This appears to just be a case of the analyzer not
properly modelling returned temporaries.

While I'm in the area, unique_ptr<T, decltype(free)> is generally an
antipattern: if we instead use an empty struct with an attached
operator(), the unique_ptr shrinks to sizeof(void *) bytes (instead of
sizeof(void *) * 2), and the compiler no longer has to indirectly call
free().

As luck would have it, this small refactor makes the analyzer stop
complaining about this code.

Bug: None
Test: Ran the static analyzer. It's happier, and this builds.
Change-Id: I0c98860e2169ceb8e9d21e577cad89d1ef2c6ff9
parent 0544b1ac
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment