Fixed a bug in io.c causing a segmentation fault on hard reset.

This commit is contained in:
OBattler
2018-02-02 01:14:07 +01:00
parent 6fd6097467
commit b18635a562

View File

@@ -8,7 +8,7 @@
* *
* Implement I/O ports and their operations. * Implement I/O ports and their operations.
* *
* Version: @(#)io.c 1.0.2 2018/02/01 * Version: @(#)io.c 1.0.3 2018/02/02
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -66,7 +66,7 @@ io_init(void)
if (!initialized) { if (!initialized) {
for (c=0; c<NPORTS; c++) for (c=0; c<NPORTS; c++)
io[c] = NULL; io[c] = io_last[c] = NULL;
initialized = 1; initialized = 1;
} }
@@ -87,7 +87,7 @@ io_init(void)
/* io[c] should be the only handler, pointing at the NULL catch handler. */ /* io[c] should be the only handler, pointing at the NULL catch handler. */
p = (io_t *) malloc(sizeof(io_t)); p = (io_t *) malloc(sizeof(io_t));
memset(p, 0, sizeof(io_t)); memset(p, 0, sizeof(io_t));
io[c] = p; io[c] = io_last[c] = p;
p->next = NULL; p->next = NULL;
p->prev = NULL; p->prev = NULL;
p->inb = null_inb; p->inb = null_inb;
@@ -99,7 +99,7 @@ io_init(void)
p->priv = NULL; p->priv = NULL;
#else #else
/* io[c] should be NULL. */ /* io[c] should be NULL. */
io[c] = NULL; io[c] = io_last[c] = NULL;
#endif #endif
} }
} }