diff --git a/src/barebox-state/backend.c b/src/barebox-state/backend.c index 2f2e6df..5235bb0 100644 --- a/src/barebox-state/backend.c +++ b/src/barebox-state/backend.c @@ -164,7 +164,7 @@ if (ret) goto out_free_format; - backend->of_path = of_path; + backend->of_path = xstrdup(of_path); return 0; @@ -185,4 +185,5 @@ state_storage_free(&backend->storage); if (backend->format) state_format_free(backend->format); + free(backend->of_path); } diff --git a/src/barebox-state/state.h b/src/barebox-state/state.h index 48a6785..eb349af 100644 --- a/src/barebox-state/state.h +++ b/src/barebox-state/state.h @@ -86,7 +86,7 @@ struct state_backend { struct state_backend_format *format; struct state_backend_storage storage; - const char *of_path; + char *of_path; }; struct state {