Signed-off-by: Stephan Holljes <klaxa1...@googlemail.com>
---
 ffserver.c | 4 ++++
 segment.c  | 1 +
 2 files changed, 5 insertions(+)

diff --git a/ffserver.c b/ffserver.c
index 3abf5f8..50d61e5 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -151,6 +151,10 @@ void *read_thread(void *arg)
                 av_log(NULL, AV_LOG_DEBUG, "Published new segment.\n");
             }
             segment_init(&seg, ifmt_ctx);
+            if (!seg) {
+                av_log(NULL, AV_LOG_ERROR, "Segment initialization failed, 
shutting down.\n");
+                goto end;
+            }
             seg->id = id++;
             av_log(NULL, AV_LOG_DEBUG, "Starting new segment, id: %d\n", 
seg->id);
         }
diff --git a/segment.c b/segment.c
index 986aeb5..72c4663 100644
--- a/segment.c
+++ b/segment.c
@@ -116,6 +116,7 @@ void segment_init(struct Segment **seg_p, AVFormatContext 
*fmt)
     struct Segment *seg = (struct Segment*) av_malloc(sizeof(struct Segment));
     if (!seg) {
         av_log(fmt, AV_LOG_ERROR, "Could not allocate segment.\n");
+        *seg_p = NULL;
         return;
     }
 
-- 
2.16.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to