@@ -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);
}
@@ -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;
}
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com> --- ffserver.c | 4 ++++ segment.c | 1 + 2 files changed, 5 insertions(+)