diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-24 18:44:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-24 18:44:52 -0400 |
commit | 1e46672463d56acc6d64bcc0ec393b7f0ee50889 (patch) | |
tree | 45d34cd761fa18b7c77aa7b2c17871f7d5f04c58 /src | |
parent | 5054264d93bff2ad54d909d796e93f3081ee9703 (diff) | |
download | stasis-1e46672463d56acc6d64bcc0ec393b7f0ee50889.tar.gz |
Fix up result [de]allocation in fix_tox_conf
Diffstat (limited to 'src')
-rw-r--r-- | src/utils.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils.c b/src/utils.c index da340db..d45f33a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -601,7 +601,7 @@ int fix_tox_conf(const char *filename, char **result) { } if (!*result) { - *result = calloc(PATH_MAX, sizeof(*result)); + *result = calloc(PATH_MAX, sizeof(**result)); if (!*result) { return -1; } @@ -610,10 +610,10 @@ int fix_tox_conf(const char *filename, char **result) { toxini = ini_open(filename); if (!toxini) { if (fptemp) { + guard_free(result); guard_free(tempfile); fclose(fptemp); } - guard_free(*result); return -1; } @@ -630,7 +630,7 @@ int fix_tox_conf(const char *filename, char **result) { tmp = realloc(data->value, strlen(data->value) + strlen(with_posargs) + 1); if (!tmp) { SYSERROR("failed to increase data->value size to +%zu bytes", strlen(data->value) + strlen(with_posargs) + 1); - guard_free(result); + guard_free(*result); return -1; } else if (tmp != data->value) { data->value = tmp; @@ -646,7 +646,7 @@ int fix_tox_conf(const char *filename, char **result) { ini_write(toxini, &fptemp); fclose(fptemp); - *result = tempfile; + strcpy(*result, tempfile); guard_free(tempfile); ini_free(&toxini); |