mirror of
https://github.com/xHyroM/gimi.git
synced 2024-11-10 02:38:06 +01:00
fix: free config & provider after using
This commit is contained in:
parent
4c3271703d
commit
c4222ac9e6
1 changed files with 4 additions and 2 deletions
|
@ -29,7 +29,6 @@ int provider_info(int argc, char **argv) {
|
||||||
ASSERT_CONFIG_EXIST(cfg);
|
ASSERT_CONFIG_EXIST(cfg);
|
||||||
|
|
||||||
struct gimi_config_provider *provider = config_find_provider(cfg, argv[1]);
|
struct gimi_config_provider *provider = config_find_provider(cfg, argv[1]);
|
||||||
config_free(cfg);
|
|
||||||
|
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
printf("error: no such provider '%s'", argv[1]);
|
printf("error: no such provider '%s'", argv[1]);
|
||||||
|
@ -40,6 +39,7 @@ int provider_info(int argc, char **argv) {
|
||||||
printf("ssh: %s\n", provider->ssh);
|
printf("ssh: %s\n", provider->ssh);
|
||||||
printf("primary: %d\n", provider->primary);
|
printf("primary: %d\n", provider->primary);
|
||||||
|
|
||||||
|
config_free(cfg);
|
||||||
free(provider);
|
free(provider);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -55,7 +55,6 @@ int provider_sync(int argc, char **argv) {
|
||||||
ASSERT_CONFIG_EXIST(cfg);
|
ASSERT_CONFIG_EXIST(cfg);
|
||||||
|
|
||||||
struct gimi_config_provider *provider = config_find_provider(cfg, argv[1]);
|
struct gimi_config_provider *provider = config_find_provider(cfg, argv[1]);
|
||||||
config_free(cfg);
|
|
||||||
|
|
||||||
char command[100];
|
char command[100];
|
||||||
snprintf(command, sizeof(command), "git remote add gimi-%s %s",
|
snprintf(command, sizeof(command), "git remote add gimi-%s %s",
|
||||||
|
@ -70,6 +69,9 @@ int provider_sync(int argc, char **argv) {
|
||||||
provider->name);
|
provider->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config_free(cfg);
|
||||||
|
free(provider);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue