From 652ffa646e912b4cabd89fab41aaa25ee2b35757 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 19 Jul 2024 22:02:02 +0200 Subject: [PATCH] Added a sanity check to device.c. --- src/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/device.c b/src/device.c index 6fadc901b..b9dba8fd6 100644 --- a/src/device.c +++ b/src/device.c @@ -186,7 +186,8 @@ device_add_common(const device_t *dev, void *p, void *params, int inst) devices[c] = NULL; device_priv[c] = NULL; - free(init_dev); + if (init_dev != NULL) + free(init_dev); return (NULL); }