From dfe83ac32aa4883c7ca4d58d8c448f505a957e6f Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 19 Jul 2024 22:08:37 +0200 Subject: [PATCH] Do not attempt to free init_dev if it's pointing to the const device itself. --- src/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device.c b/src/device.c index b9dba8fd6..be39847e6 100644 --- a/src/device.c +++ b/src/device.c @@ -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);