summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Borleis <jbe@pengutronix.de>2017-08-15 15:46:32 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-06 14:01:48 +0200
commit9f91974e299a68c83cefafa35f11bcdbb4b9a5f7 (patch)
tree3d7b73e04d27ef96e11712d6129a976ab919c56c
parent480cde1b22831febacc2a8ab91dfe99d2e5be8e9 (diff)
downloadbarebox-9f91974e299a68c83cefafa35f11bcdbb4b9a5f7.tar.gz
bootchooser: avoid a use after free
Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/bootchooser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/bootchooser.c b/common/bootchooser.c
index 455f290..69d980d 100644
--- a/common/bootchooser.c
+++ b/common/bootchooser.c
@@ -376,9 +376,9 @@ struct bootchooser *bootchooser_get(void)
bc->state_prefix = xstrdup(state_prefix);
bc->state = state_by_name(state_devname);
if (!bc->state) {
- free(state_devname);
pr_err("Cannot get state '%s'\n",
state_devname);
+ free(state_devname);
ret = -ENODEV;
goto err;
}