Device: Do not free init_dev if points to dev, fixes SIGTRAP.
This commit is contained in:
@@ -137,8 +137,8 @@ device_context_restore(void)
|
|||||||
static void *
|
static void *
|
||||||
device_add_common(const device_t *dev, void *p, void *params, int inst)
|
device_add_common(const device_t *dev, void *p, void *params, int inst)
|
||||||
{
|
{
|
||||||
device_t *init_dev;
|
device_t *init_dev = NULL;
|
||||||
void *priv = NULL;
|
void *priv = NULL;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if (params != NULL) {
|
if (params != NULL) {
|
||||||
@@ -204,7 +204,8 @@ device_add_common(const device_t *dev, void *p, void *params, int inst)
|
|||||||
} else
|
} else
|
||||||
device_priv[c] = p;
|
device_priv[c] = p;
|
||||||
|
|
||||||
free(init_dev);
|
if (init_dev != dev)
|
||||||
|
free(init_dev);
|
||||||
|
|
||||||
return priv;
|
return priv;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user