mirror of
https://github.com/apache/nuttx.git
synced 2026-05-25 17:55:17 +08:00
Several MTD FLASH drivers nullify the freed 'priv' structure and failed to return NULL as stated in the comments. Result, will operate on a NULL pointer later. Noted by David Sidrane.
This commit is contained in:
+1
-1
@@ -673,7 +673,7 @@ FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev)
|
||||
|
||||
ferr("ERROR: Unrecognized\n");
|
||||
kmm_free(priv);
|
||||
priv = NULL;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -978,7 +978,7 @@ FAR struct mtd_dev_s *is25xp_initialize(FAR struct spi_dev_s *dev)
|
||||
|
||||
ferr("ERROR: Unrecognized\n");
|
||||
kmm_free(priv);
|
||||
priv = NULL;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -999,4 +999,3 @@ FAR struct mtd_dev_s *is25xp_initialize(FAR struct spi_dev_s *dev)
|
||||
finfo("Return %p\n", priv);
|
||||
return (FAR struct mtd_dev_s *)priv;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1033,7 +1033,7 @@ FAR struct mtd_dev_s *m25p_initialize(FAR struct spi_dev_s *dev)
|
||||
|
||||
ferr("ERROR: Unrecognized\n");
|
||||
kmm_free(priv);
|
||||
priv = NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -826,7 +826,7 @@ FAR struct mtd_dev_s *ramtron_initialize(FAR struct spi_dev_s *dev)
|
||||
/* Unrecognized! Discard all of that work we just did and return NULL */
|
||||
|
||||
kmm_free(priv);
|
||||
priv = NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1208,7 +1208,7 @@ FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev)
|
||||
|
||||
ferr("ERROR: Unrecognized\n");
|
||||
kmm_free(priv);
|
||||
priv = NULL;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -956,7 +956,7 @@ FAR struct mtd_dev_s *sst25xx_initialize(FAR struct spi_dev_s *dev)
|
||||
|
||||
ferr("ERROR: Unrecognized\n");
|
||||
kmm_free(priv);
|
||||
priv = NULL;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+1
-1
@@ -934,7 +934,7 @@ FAR struct mtd_dev_s *sst26_initialize_spi(FAR struct spi_dev_s *dev)
|
||||
|
||||
ssterr("ERROR: Unrecognized\n");
|
||||
kmm_free(priv);
|
||||
priv = NULL;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+1
-1
@@ -1258,7 +1258,7 @@ FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *spi)
|
||||
|
||||
ferr("ERROR: Unrecognized\n");
|
||||
kmm_free(priv);
|
||||
priv = NULL;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user