[libbluray-devel] use calloc
hpi1
git at videolan.org
Tue Jan 6 15:42:46 CET 2015
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Jan 6 16:42:28 2015 +0200| [c976b4c4ee71297f65ac16e312feec8268b0cbbd] | committer: hpi1
use calloc
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=c976b4c4ee71297f65ac16e312feec8268b0cbbd
---
src/file/dir_posix.c | 2 +-
src/file/dir_win32.c | 2 +-
src/file/file_posix.c | 2 +-
src/file/file_win32.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/file/dir_posix.c b/src/file/dir_posix.c
index 1114838..2752657 100644
--- a/src/file/dir_posix.c
+++ b/src/file/dir_posix.c
@@ -62,7 +62,7 @@ static int _dir_read_posix(BD_DIR_H *dir, BD_DIRENT *entry)
static BD_DIR_H *_dir_open_posix(const char* dirname)
{
- BD_DIR_H *dir = malloc(sizeof(BD_DIR_H));
+ BD_DIR_H *dir = calloc(1, sizeof(BD_DIR_H));
BD_DEBUG(DBG_DIR, "Opening POSIX dir %s... (%p)\n", dirname, (void*)dir);
dir->close = _dir_close_posix;
diff --git a/src/file/dir_win32.c b/src/file/dir_win32.c
index f2e8f1c..6fb7b9a 100644
--- a/src/file/dir_win32.c
+++ b/src/file/dir_win32.c
@@ -72,7 +72,7 @@ static int _dir_read_win32(BD_DIR_H *dir, BD_DIRENT *entry)
static BD_DIR_H *_dir_open_win32(const char* dirname)
{
- BD_DIR_H *dir = malloc(sizeof(BD_DIR_H));
+ BD_DIR_H *dir = calloc(1, sizeof(BD_DIR_H));
BD_DEBUG(DBG_DIR, "Opening WIN32 dir %s... (%p)\n", dirname, (void*)dir);
dir->close = _dir_close_win32;
diff --git a/src/file/file_posix.c b/src/file/file_posix.c
index c488fc2..6d4d4b5 100644
--- a/src/file/file_posix.c
+++ b/src/file/file_posix.c
@@ -79,7 +79,7 @@ static int64_t file_write_linux(BD_FILE_H *file, const uint8_t *buf, int64_t siz
static BD_FILE_H *file_open_linux(const char* filename, const char *mode)
{
FILE *fp = NULL;
- BD_FILE_H *file = malloc(sizeof(BD_FILE_H));
+ BD_FILE_H *file = calloc(1, sizeof(BD_FILE_H));
BD_DEBUG(DBG_FILE, "Opening LINUX file %s... (%p)\n", filename, (void*)file);
file->close = file_close_linux;
diff --git a/src/file/file_win32.c b/src/file/file_win32.c
index 2418d5a..42a3fa8 100644
--- a/src/file/file_win32.c
+++ b/src/file/file_win32.c
@@ -100,7 +100,7 @@ static BD_FILE_H *_file_open(const char* filename, const char *mode)
MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, mode, -1, wmode, 8) &&
(fp = _wfopen(wfilename, wmode))) {
- BD_FILE_H *file = malloc(sizeof(BD_FILE_H));
+ BD_FILE_H *file = calloc(1, sizeof(BD_FILE_H));
file->internal = fp;
file->close = _file_close;
file->seek = _file_seek;
More information about the libbluray-devel
mailing list