libbluray | branch: master | ace20022 <[email protected]> | Thu Nov 12 12:36:59 2015 +0100| [1d36ee35ddfc177a0678987500a3de331645bd53] | committer: hpi1
Check realloc result. > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=1d36ee35ddfc177a0678987500a3de331645bd53 --- src/libbluray/bluray.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c index b4d91a8..1aedf2c 100644 --- a/src/libbluray/bluray.c +++ b/src/libbluray/bluray.c @@ -798,7 +798,15 @@ static int _preload_m2ts(BLURAY *bd, BD_PRELOAD *p) /* allocate buffer */ p->clip_size = (size_t)st.clip_size; - p->buf = realloc(p->buf, p->clip_size); + uint8_t* tmp = (uint8_t*)realloc(p->buf, p->clip_size); + if (!tmp) { + BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_preload_m2ts(): out of memory\n"); + _close_m2ts(&st); + _close_preload(p); + return 0; + } + + p->buf = tmp; /* read clip to buffer */ _______________________________________________ libbluray-devel mailing list [email protected] https://mailman.videolan.org/listinfo/libbluray-devel
