---
 libavcodec/mlp_parser.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 075227f..d057d46 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -227,7 +227,7 @@ static int mlp_parse(AVCodecParserContext *s,
     MLPParseContext *mp = s->priv_data;
     int sync_present;
     uint8_t parity_bits;
-    int next;
+    int next, ret;
     int i, p = 0;
 
     *poutbuf_size = 0;
@@ -249,11 +249,16 @@ static int mlp_parse(AVCodecParserContext *s,
         }
 
         if (!mp->in_sync) {
-            ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size);
+            ret = ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size);
+            if (ret == AVERROR(ENOMEM))
+                return ret;
+
             return buf_size;
         }
 
-        ff_combine_frame(&mp->pc, i - 7, &buf, &buf_size);
+        ret = ff_combine_frame(&mp->pc, i - 7, &buf, &buf_size);
+        if (ret == AVERROR(ENOMEM))
+            return ret;
 
         return i - 7;
     }
@@ -267,7 +272,9 @@ static int mlp_parse(AVCodecParserContext *s,
         }
 
         if (mp->pc.index + buf_size < 2) {
-            ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size);
+            ret = ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size);
+            if (ret == AVERROR(ENOMEM))
+                return ret;
             return buf_size;
         }
 
@@ -279,10 +286,13 @@ static int mlp_parse(AVCodecParserContext *s,
 
     next = (mp->bytes_left > buf_size) ? END_NOT_FOUND : mp->bytes_left;
 
-    if (ff_combine_frame(&mp->pc, next, &buf, &buf_size) < 0) {
+    ret = ff_combine_frame(&mp->pc, next, &buf, &buf_size);
+    if (ret == AVERROR(EAGAIN)) {
         mp->bytes_left -= buf_size;
         return buf_size;
     }
+    if (ret == AVERROR(ENOMEM))
+        return ret;
 
     mp->bytes_left = 0;
 
-- 
1.8.3.2

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to