[libbluray-devel] Check for calloc() return value
hpi1
git at videolan.org
Mon Jan 9 10:25:29 CET 2012
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Jan 2 13:20:14 2012 +0200| [872bcb55f0d86a4a7b99447e05db8cd8c6194f18] | committer: hpi1
Check for calloc() return value
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=872bcb55f0d86a4a7b99447e05db8cd8c6194f18
---
src/libbluray/bluray.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index ae301d7..a969bcd 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -922,6 +922,11 @@ BLURAY *bd_open(const char* device_path, const char* keyfile_path)
BLURAY *bd = calloc(1, sizeof(BLURAY));
+ if (!bd) {
+ BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Can't allocate memory\n");
+ return NULL;
+ }
+
bd->device_path = (char*)malloc(strlen(device_path) + 1);
strcpy(bd->device_path, device_path);
More information about the libbluray-devel
mailing list