summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libflashrom.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libflashrom.c b/libflashrom.c
index d66c29596..5f14c6818 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -361,6 +361,9 @@ size_t flashrom_flash_getsize(const struct flashrom_flashctx *const flashctx)
*/
void flashrom_flash_release(struct flashrom_flashctx *const flashctx)
{
+ if (!flashctx)
+ return;
+
flashrom_layout_release(flashctx->default_layout);
free(flashctx->chip);
free(flashctx);