Commit 76f81347 authored by Steve Dibb's avatar Steve Dibb Committed by Jean-Baptiste Kempf

Use calloc instead of malloc, then memset

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent a63467f9
......@@ -292,12 +292,10 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
int bup_file_opened = 0;
char ifo_filename[13];
ifofile = malloc(sizeof(ifo_handle_t));
ifofile = calloc(1, sizeof(ifo_handle_t));
if(!ifofile)
return NULL;
memset(ifofile, 0, sizeof(ifo_handle_t));
ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_FILE);
if(!ifofile->file) { /* Failed to open IFO, try to open BUP */
ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE);
......@@ -359,11 +357,10 @@ ifoOpen_try_bup:
/* Try BUP instead */
ifoClose(ifofile);
ifofile = malloc(sizeof(ifo_handle_t));
ifofile = calloc(1, sizeof(ifo_handle_t));
if(!ifofile)
return NULL;
memset(ifofile, 0, sizeof(ifo_handle_t));
ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE);
if (title)
......@@ -425,12 +422,10 @@ ifoOpen_fail:
ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) {
ifo_handle_t *ifofile;
ifofile = malloc(sizeof(ifo_handle_t));
ifofile = calloc(1, sizeof(ifo_handle_t));
if(!ifofile)
return NULL;
memset(ifofile, 0, sizeof(ifo_handle_t));
ifofile->file = DVDOpenFile(dvd, 0, DVD_READ_INFO_FILE);
if(!ifofile->file) /* Should really catch any error and try to fallback */
ifofile->file = DVDOpenFile(dvd, 0, DVD_READ_INFO_BACKUP_FILE);
......@@ -452,12 +447,10 @@ ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) {
ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) {
ifo_handle_t *ifofile;
ifofile = malloc(sizeof(ifo_handle_t));
ifofile = calloc(1, sizeof(ifo_handle_t));
if(!ifofile)
return NULL;
memset(ifofile, 0, sizeof(ifo_handle_t));
if(title <= 0 || title > 99) {
fprintf(stderr, "libdvdread: ifoOpenVTSI invalid title (%d).\n", title);
free(ifofile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment