On Sun, May 20, 2018 at 6:42 AM, Martin Ågren <martin.agren@xxxxxxxxx> wrote: > Instead of remembering to free `key` in each code path, let > `config_store_data_clear()` handle that. > > We still need to free it before replacing it, though. Move that freeing > closer to the replacing to be safe. Note that in that same part of the > code, we can no longer set `key` to the original pointer, but need to > `xstrdup()` it. That casting away of 'const' was an oddball case anyhow, so it's nice to see it go away (even at the expense of an extra xstrdup()). Overall, this change makes it quite a bit easier to reason about the cleanup of 'store.key'. Thanks. > Signed-off-by: Martin Ågren <martin.agren@xxxxxxxxx>