Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
88e63017
Commit
88e63017
authored
Oct 30, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer/software: fix double free bug
parent
da8bdd62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
SoftwareMixerPlugin.cxx
src/mixer/SoftwareMixerPlugin.cxx
+15
-3
No files found.
src/mixer/SoftwareMixerPlugin.cxx
View file @
88e63017
...
...
@@ -41,18 +41,28 @@ CreateVolumeFilter()
struct
SoftwareMixer
final
:
public
Mixer
{
Filter
*
filter
;
/**
* If this is true, then this object "owns" the #Filter
* instance (see above). It will be set to false by
* software_mixer_get_filter(); after that, the caller will be
* responsible for the #Filter.
*/
bool
owns_filter
;
unsigned
volume
;
SoftwareMixer
()
:
Mixer
(
software_mixer_plugin
),
filter
(
CreateVolumeFilter
()),
volume
(
100
)
filter
(
CreateVolumeFilter
()),
owns_filter
(
true
),
volume
(
100
)
{
assert
(
filter
!=
nullptr
);
}
~
SoftwareMixer
()
{
delete
filter
;
if
(
owns_filter
)
delete
filter
;
}
};
...
...
@@ -115,6 +125,8 @@ software_mixer_get_filter(Mixer *mixer)
{
SoftwareMixer
*
sm
=
(
SoftwareMixer
*
)
mixer
;
assert
(
sm
->
IsPlugin
(
software_mixer_plugin
));
assert
(
sm
->
owns_filter
);
sm
->
owns_filter
=
false
;
return
sm
->
filter
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment