summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io-module/mts_io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index cd39f99..b3c3a10 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -408,6 +408,8 @@ static bool load_port(int port) {
}
} else {
log_error("unknown accessory card [%s] in port %d", ap_eeprom[port_index].product_id, port);
+ kfree(port_info[port_index]);
+ port_info[port_index] = NULL;
return false;
}
@@ -429,7 +431,8 @@ static bool load_port(int port) {
if (! port_info[port_index]->setup(port)) {
log_error("accessory port %d setup failed", port);
port_info[port_index]->teardown(port);
- kfree(port_info[port]);
+ kfree(port_info[port_index]);
+ port_info[port_index] = NULL;
return false;
}
}