diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-14 15:45:50 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-14 15:45:50 -0400 |
commit | 7656ed0e011f910b84131360cc82e335f01913db (patch) | |
tree | 9d04fb0ed894c84388aa327ae3da9cf3cb0f6327 /src/utils.c | |
parent | 2671b05f92e834ee937b54c89b753960213353c8 (diff) | |
download | stasis-7656ed0e011f910b84131360cc82e335f01913db.tar.gz |
Allow path_store function to replace existing path elements without causing memory leaks
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index d1f3f8f..62bf58a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -517,6 +517,10 @@ int path_store(char **destptr, size_t maxlen, const char *base, const char *path goto l_path_setup_error; } + if (*destptr) { + guard_free(*destptr); + } + (*destptr) = realpath(path_tmp, NULL); if (!*destptr) { goto l_path_setup_error; |