[libbluray-devel] Check malloc result

Petri Hintukainen git at videolan.org
Sat Jun 24 14:38:22 CEST 2017


libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Sat Jun 24 12:34:29 2017 +0300| [0e53642cccd9f6e485ddab7eaa0f24f98cf6fe24] | committer: Petri Hintukainen

Check malloc result

> http://git.videolan.org/gitweb.cgi/libudfread.git/?a=commit;h=0e53642cccd9f6e485ddab7eaa0f24f98cf6fe24
---

 src/udfread.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/udfread.c b/src/udfread.c
index d3cde6c..f809d61 100644
--- a/src/udfread.c
+++ b/src/udfread.c
@@ -1599,6 +1599,9 @@ ssize_t udfread_file_read(UDFFILE *p, void *buf, size_t bytes)
     /* allocate temp storage for input block */
     if (!p->block) {
         p->block_mem = malloc(2 * UDF_BLOCK_SIZE);
+        if (!p->block_mem) {
+            return -1;
+        }
         p->block = ALIGN(p->block_mem, UDF_BLOCK_SIZE);
     }
 



More information about the libbluray-devel mailing list