Fixed NULL pointer dereferences in the CD-ROM image code.

This commit is contained in:
OBattler
2020-01-13 21:46:45 +01:00
committed by GitHub
parent dcf06f4ba9
commit fb088329e1

View File

@@ -9,7 +9,7 @@
* CD-ROM image file handling module, translated to C from * CD-ROM image file handling module, translated to C from
* cdrom_dosbox.cpp. * cdrom_dosbox.cpp.
* *
* Version: @(#)cdrom_image_backend.c 1.0.3 2020/01/13 * Version: @(#)cdrom_image_backend.c 1.0.4 2020/01/13
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -136,9 +136,7 @@ bin_init(const wchar_t *filename, int *error)
track_file_t *tf = (track_file_t *) malloc(sizeof(track_file_t)); track_file_t *tf = (track_file_t *) malloc(sizeof(track_file_t));
if (tf == NULL) { if (tf == NULL) {
tf->read = NULL; *error = 1;
tf->get_length = NULL;
tf->close = NULL;
return NULL; return NULL;
} }
@@ -157,9 +155,6 @@ bin_init(const wchar_t *filename, int *error)
} else { } else {
free(tf); free(tf);
tf = NULL; tf = NULL;
tf->read = NULL;
tf->get_length = NULL;
tf->close = NULL;
} }
return tf; return tf;