free strings after use

This commit is contained in:
jacekpoz 2024-02-11 19:50:44 +01:00
parent c013f078ab
commit cca7224559
No known key found for this signature in database
GPG key ID: 94E812A8B12AAE3C

View file

@ -218,12 +218,14 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "error: failed formatting config dir (this shouldn't happen)"); fprintf(stderr, "error: failed formatting config dir (this shouldn't happen)");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
free(home);
} }
if (asprintf(&config_path, "%s/modfetch.conf", config_dir) < 0) { if (asprintf(&config_path, "%s/modfetch.conf", config_dir) < 0) {
fprintf(stderr, "error: failed formatting config path (this shouldn't happen)"); fprintf(stderr, "error: failed formatting config path (this shouldn't happen)");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
free(config_dir);
for (size_t i = 1; i < (size_t)argc; ++i) { for (size_t i = 1; i < (size_t)argc; ++i) {
if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--config") == 0) { if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--config") == 0) {
@ -257,6 +259,7 @@ int main(int argc, char *argv[]) {
Config config = parse_config(config_file); Config config = parse_config(config_file);
fclose(config_file); fclose(config_file);
free(config_path);
for (size_t i = 0; i < config.module_count; ++i) { for (size_t i = 0; i < config.module_count; ++i) {
Module current_module = config.modules[i]; Module current_module = config.modules[i];