OSDN Git Service
(root)
/
android-x86
/
external-ffmpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
03f30c8
)
pthread: add some malloc failure checks
author
Justin Ruggles
<justin.ruggles@gmail.com>
Wed, 16 Nov 2011 22:30:28 +0000
(17:30 -0500)
committer
Justin Ruggles
<justin.ruggles@gmail.com>
Mon, 21 Nov 2011 15:18:25 +0000
(10:18 -0500)
libavcodec/pthread.c
patch
|
blob
|
history
diff --git
a/libavcodec/pthread.c
b/libavcodec/pthread.c
index
9fe9b8d
..
42b82a5
100644
(file)
--- a/
libavcodec/pthread.c
+++ b/
libavcodec/pthread.c
@@
-719,6
+719,11
@@
static int frame_thread_init(AVCodecContext *avctx)
p->parent = fctx;
p->avctx = copy;
+ if (!copy) {
+ err = AVERROR(ENOMEM);
+ goto error;
+ }
+
*copy = *src;
copy->thread_opaque = p;
copy->pkt = &p->avpkt;
@@
-732,6
+737,10
@@
static int frame_thread_init(AVCodecContext *avctx)
update_context_from_thread(avctx, copy, 1);
} else {
copy->priv_data = av_malloc(codec->priv_data_size);
+ if (!copy->priv_data) {
+ err = AVERROR(ENOMEM);
+ goto error;
+ }
memcpy(copy->priv_data, src->priv_data, codec->priv_data_size);
copy->internal = av_malloc(sizeof(AVCodecInternal));
if (!copy->internal) {