]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/nut.c
Merge commit '13207484bba8a8b78b40d5a22da8c9c555429089'
[ffmpeg] / libavformat / nut.c
index 7e7997998f95f6224819b44219871b55804fafaa..8b8a4cb8ac826be6dcc2ecbd0d61420874db4e92 100644 (file)
@@ -227,11 +227,17 @@ int ff_nut_sp_pts_cmp(const Syncpoint *a, const Syncpoint *b)
     return ((a->ts - b->ts) >> 32) - ((b->ts - a->ts) >> 32);
 }
 
-void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts)
+int ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts)
 {
     Syncpoint *sp           = av_mallocz(sizeof(Syncpoint));
     struct AVTreeNode *node = av_tree_node_alloc();
 
+    if (!sp || !node) {
+        av_freep(&sp);
+        av_freep(&node);
+        return AVERROR(ENOMEM);
+    }
+
     nut->sp_count++;
 
     sp->pos      = pos;
@@ -242,6 +248,8 @@ void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts)
         av_free(sp);
         av_free(node);
     }
+
+    return 0;
 }
 
 static int enu_free(void *opaque, void *elem)