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
02cb7d4c
Commit
02cb7d4c
authored
Nov 22, 2014
by
Lukasz Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/smvjpegdec: fix mem leak in case of init failure
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki2@gmail.com
>
parent
efe34e87
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
smvjpegdec.c
libavcodec/smvjpegdec.c
+19
-15
No files found.
libavcodec/smvjpegdec.c
View file @
02cb7d4c
...
...
@@ -75,6 +75,20 @@ static inline void smv_img_pnt(uint8_t *dst_data[4], uint8_t *src_data[4],
dst_data
[
1
]
=
src_data
[
1
];
}
static
av_cold
int
smvjpeg_decode_end
(
AVCodecContext
*
avctx
)
{
SMVJpegDecodeContext
*
s
=
avctx
->
priv_data
;
MJpegDecodeContext
*
jpg
=
&
s
->
jpg
;
int
ret
;
jpg
->
picture_ptr
=
NULL
;
av_frame_free
(
&
s
->
picture
[
0
]);
av_frame_free
(
&
s
->
picture
[
1
]);
ret
=
avcodec_close
(
s
->
avctx
);
av_freep
(
&
s
->
avctx
);
return
ret
;
}
static
av_cold
int
smvjpeg_decode_init
(
AVCodecContext
*
avctx
)
{
SMVJpegDecodeContext
*
s
=
avctx
->
priv_data
;
...
...
@@ -89,8 +103,10 @@ static av_cold int smvjpeg_decode_init(AVCodecContext *avctx)
return
AVERROR
(
ENOMEM
);
s
->
picture
[
1
]
=
av_frame_alloc
();
if
(
!
s
->
picture
[
1
])
if
(
!
s
->
picture
[
1
])
{
av_frame_free
(
&
s
->
picture
[
0
]);
return
AVERROR
(
ENOMEM
);
}
s
->
jpg
.
picture_ptr
=
s
->
picture
[
0
];
...
...
@@ -120,6 +136,8 @@ static av_cold int smvjpeg_decode_init(AVCodecContext *avctx)
}
av_dict_free
(
&
thread_opt
);
if
(
ret
<
0
)
smvjpeg_decode_end
(
avctx
);
return
ret
;
}
...
...
@@ -176,20 +194,6 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_siz
return
ret
;
}
static
av_cold
int
smvjpeg_decode_end
(
AVCodecContext
*
avctx
)
{
SMVJpegDecodeContext
*
s
=
avctx
->
priv_data
;
MJpegDecodeContext
*
jpg
=
&
s
->
jpg
;
int
ret
;
jpg
->
picture_ptr
=
NULL
;
av_frame_free
(
&
s
->
picture
[
0
]);
av_frame_free
(
&
s
->
picture
[
1
]);
ret
=
avcodec_close
(
s
->
avctx
);
av_freep
(
&
s
->
avctx
);
return
ret
;
}
static
const
AVClass
smvjpegdec_class
=
{
.
class_name
=
"SMVJPEG decoder"
,
.
item_name
=
av_default_item_name
,
...
...
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