Do not attempt to free init_dev if it's pointing to the const device itself.

This commit is contained in:
OBattler
2024-07-19 22:08:37 +02:00
parent 652ffa646e
commit dfe83ac32a

View File

@@ -186,7 +186,7 @@ device_add_common(const device_t *dev, void *p, void *params, int inst)
devices[c] = NULL;
device_priv[c] = NULL;
if (init_dev != NULL)
if ((init_dev != NULL) && (init_dev != (device_t *) dev))
free(init_dev);
return (NULL);