Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
18bcfc91
Commit
18bcfc91
authored
Dec 25, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shorten: Fix invalid free()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
1795fed7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
shorten.c
libavcodec/shorten.c
+7
-6
No files found.
libavcodec/shorten.c
View file @
18bcfc91
...
@@ -86,6 +86,7 @@ typedef struct ShortenContext {
...
@@ -86,6 +86,7 @@ typedef struct ShortenContext {
int
channels
;
int
channels
;
int32_t
*
decoded
[
MAX_CHANNELS
];
int32_t
*
decoded
[
MAX_CHANNELS
];
int32_t
*
decoded_base
[
MAX_CHANNELS
];
int32_t
*
offset
[
MAX_CHANNELS
];
int32_t
*
offset
[
MAX_CHANNELS
];
int
*
coeffs
;
int
*
coeffs
;
uint8_t
*
bitstream
;
uint8_t
*
bitstream
;
...
@@ -140,13 +141,13 @@ static int allocate_buffers(ShortenContext *s)
...
@@ -140,13 +141,13 @@ static int allocate_buffers(ShortenContext *s)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
s
->
offset
[
chan
]
=
tmp_ptr
;
s
->
offset
[
chan
]
=
tmp_ptr
;
tmp_ptr
=
av_realloc
(
s
->
decoded
[
chan
],
sizeof
(
int32_t
)
*
(
s
->
blocksize
+
s
->
nwrap
));
tmp_ptr
=
av_realloc
(
s
->
decoded
_base
[
chan
],
sizeof
(
int32_t
)
*
(
s
->
blocksize
+
s
->
nwrap
));
if
(
!
tmp_ptr
)
if
(
!
tmp_ptr
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
s
->
decoded
[
chan
]
=
tmp_ptr
;
s
->
decoded
_base
[
chan
]
=
tmp_ptr
;
for
(
i
=
0
;
i
<
s
->
nwrap
;
i
++
)
for
(
i
=
0
;
i
<
s
->
nwrap
;
i
++
)
s
->
decoded
[
chan
][
i
]
=
0
;
s
->
decoded
_base
[
chan
][
i
]
=
0
;
s
->
decoded
[
chan
]
+=
s
->
nwrap
;
s
->
decoded
[
chan
]
=
s
->
decoded_base
[
chan
]
+
s
->
nwrap
;
}
}
coeffs
=
av_realloc
(
s
->
coeffs
,
s
->
nwrap
*
sizeof
(
*
s
->
coeffs
));
coeffs
=
av_realloc
(
s
->
coeffs
,
s
->
nwrap
*
sizeof
(
*
s
->
coeffs
));
...
@@ -615,8 +616,8 @@ static av_cold int shorten_decode_close(AVCodecContext *avctx)
...
@@ -615,8 +616,8 @@ static av_cold int shorten_decode_close(AVCodecContext *avctx)
int
i
;
int
i
;
for
(
i
=
0
;
i
<
s
->
channels
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
channels
;
i
++
)
{
s
->
decoded
[
i
]
-=
s
->
nwrap
;
s
->
decoded
[
i
]
=
NULL
;
av_freep
(
&
s
->
decoded
[
i
]);
av_freep
(
&
s
->
decoded
_base
[
i
]);
av_freep
(
&
s
->
offset
[
i
]);
av_freep
(
&
s
->
offset
[
i
]);
}
}
av_freep
(
&
s
->
bitstream
);
av_freep
(
&
s
->
bitstream
);
...
...
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