Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
597c256d
Commit
597c256d
authored
7 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Fix memory leak found by scan-build.
parent
c75a81cd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/xpdev/xpbeep.c
+11
-2
11 additions, 2 deletions
src/xpdev/xpbeep.c
with
11 additions
and
2 deletions
src/xpdev/xpbeep.c
+
11
−
2
View file @
597c256d
...
...
@@ -826,6 +826,10 @@ error_return:
sample_thread_running
=
FALSE
;
}
/*
* This MUST not return false after sample goes into the sample buffer in the background.
* If it does, the caller won't be able to free() it.
*/
BOOL
DLLCALL
xp_play_sample
(
const
unsigned
char
*
sample
,
size_t
size
,
BOOL
background
)
{
if
(
!
sample_initialized
)
{
...
...
@@ -985,6 +989,7 @@ BOOL DLLCALL xptone(double freq, DWORD duration, enum WAVE_SHAPE shape)
{
unsigned
char
*
wave
;
int
samples
;
BOOL
ret
;
wave
=
(
unsigned
char
*
)
malloc
(
S_RATE
*
15
/
2
+
1
);
if
(
!
wave
)
...
...
@@ -1004,13 +1009,17 @@ BOOL DLLCALL xptone(double freq, DWORD duration, enum WAVE_SHAPE shape)
;
sample_len
++
;
while
(
samples
>
S_RATE
*
15
/
2
)
{
if
(
!
xp_play_sample
(
wave
,
sample_len
,
TRUE
))
if
(
!
xp_play_sample
(
wave
,
sample_len
,
TRUE
))
{
free
(
wave
);
return
FALSE
;
}
samples
-=
sample_len
;
}
}
makewave
(
freq
,
wave
,
samples
,
shape
);
return
(
xp_play_sample
(
wave
,
samples
,
FALSE
));
ret
=
xp_play_sample
(
wave
,
samples
,
FALSE
);
free
(
wave
);
return
ret
;
}
#ifdef __unix__
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment