summaryrefslogtreecommitdiff
path: root/libavformat/rtpdec_h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-13 01:27:26 +0100
committerMartin Storsjö <martin@martin.st>2013-12-14 17:48:46 +0200
commit9aba0a6f7b3de9381930300f49a30eadfcb63bc6 (patch)
treeb2465d4ce511d7cdf934bd90325837d197c608af /libavformat/rtpdec_h264.c
parent6451c8853a07ff2e28bda950fb5e83fcf88c5cf4 (diff)
rtpdec_h264: Check the return value of functions doing allocations
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtpdec_h264.c')
-rw-r--r--libavformat/rtpdec_h264.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index 5e0169bab3..982eb72160 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -190,7 +190,8 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
switch (type) {
case 0: // undefined, but pass them through
case 1:
- av_new_packet(pkt, len + sizeof(start_sequence));
+ if ((result = av_new_packet(pkt, len + sizeof(start_sequence))) < 0)
+ return result;
memcpy(pkt->data, start_sequence, sizeof(start_sequence));
memcpy(pkt->data + sizeof(start_sequence), buf, len);
COUNT_NAL_TYPE(data, nal);
@@ -247,7 +248,8 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
if (pass == 0) {
/* now we know the total size of the packet (with the
* start sequences added) */
- av_new_packet(pkt, total_length);
+ if ((result = av_new_packet(pkt, total_length)) < 0)
+ return result;
dst = pkt->data;
} else {
assert(dst - pkt->data == total_length);
@@ -292,12 +294,14 @@ static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data,
COUNT_NAL_TYPE(data, nal_type);
if (start_bit) {
/* copy in the start sequence, and the reconstructed nal */
- av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len);
+ if ((result = av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len)) < 0)
+ return result;
memcpy(pkt->data, start_sequence, sizeof(start_sequence));
pkt->data[sizeof(start_sequence)] = reconstructed_nal;
memcpy(pkt->data + sizeof(start_sequence) + sizeof(nal), buf, len);
} else {
- av_new_packet(pkt, len);
+ if ((result = av_new_packet(pkt, len)) < 0)
+ return result;
memcpy(pkt->data, buf, len);
}
} else {