summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/state/backend.c3
-rw-r--r--common/state/state.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/common/state/backend.c b/common/state/backend.c
index 2f2e6dfd32..5235bb0283 100644
--- a/common/state/backend.c
+++ b/common/state/backend.c
@@ -164,7 +164,7 @@ int state_backend_init(struct state_backend *backend, struct device_d *dev,
if (ret)
goto out_free_format;
- backend->of_path = of_path;
+ backend->of_path = xstrdup(of_path);
return 0;
@@ -185,4 +185,5 @@ void state_backend_free(struct state_backend *backend)
state_storage_free(&backend->storage);
if (backend->format)
state_format_free(backend->format);
+ free(backend->of_path);
}
diff --git a/common/state/state.h b/common/state/state.h
index 32146ca1bb..f930d06195 100644
--- a/common/state/state.h
+++ b/common/state/state.h
@@ -87,7 +87,7 @@ struct state_backend_storage {
struct state_backend {
struct state_backend_format *format;
struct state_backend_storage storage;
- const char *of_path;
+ char *of_path;
};
struct state {