Refactoring

This commit is contained in:
Ahmed Yarub Hani Al Nuaimi
2021-09-10 10:51:49 -03:00
parent 9271886c7d
commit a97900a799
4 changed files with 6 additions and 6 deletions

View File

@@ -54,7 +54,7 @@ authn_plugin_t *create_authn_plugin(const char *name)
return plugin; return plugin;
error: error:
free_authn_plugin(plugin); free_authn_plugin(plugin);
plugin = NULL; plugin = NULL;
return plugin; return plugin;

View File

@@ -102,7 +102,7 @@ int kube_exec_and_get_result(ExecCredential_t * exec_credential, const kubeconfi
rc = kubeyaml_parse_exec_crendential(exec_credential, result_string); rc = kubeyaml_parse_exec_crendential(exec_credential, result_string);
end: end:
if (result_string) { if (result_string) {
free(result_string); free(result_string);
} }

View File

@@ -186,7 +186,7 @@ static int kubeconfig_exec(kubeconfig_property_t * current_user)
goto end; goto end;
} }
end: end:
exec_credential_free(exec_output); exec_credential_free(exec_output);
exec_output = NULL; exec_output = NULL;
return rc; return rc;
@@ -292,7 +292,7 @@ static int kuberconfig_auth_provider(kubeconfig_property_t * current_user, kubec
} }
current_user->token = strdup(token); current_user->token = strdup(token);
end: end:
free_authn_plugin(plugin); free_authn_plugin(plugin);
plugin = NULL; plugin = NULL;
return rc; return rc;
@@ -386,7 +386,7 @@ int load_kube_config(char **pBasePath, sslConfig_t ** pSslConfig, list_t ** pApi
} }
} }
end: end:
kubeconfig_free(kubeconfig); kubeconfig_free(kubeconfig);
kubeconfig = NULL; kubeconfig = NULL;
return rc; return rc;

View File

@@ -83,7 +83,7 @@ int kube_exec(wsclient_t * wsc, const char *namespace_, const char *pod_name, co
char ws_path[WS_PATH_BUFFER_SIZE]; char ws_path[WS_PATH_BUFFER_SIZE];
memset(ws_path, 0, sizeof(ws_path)); memset(ws_path, 0, sizeof(ws_path));
snprintf(ws_path, WS_PATH_BUFFER_SIZE, ws_path_template, snprintf(ws_path, WS_PATH_BUFFER_SIZE, ws_path_template,
namespace_, pod_name, 1 == stdin ? TRUE_STRING : FALSE_STRING, 1 == stdout ? TRUE_STRING : FALSE_STRING, 1 == tty ? TRUE_STRING : FALSE_STRING, command_string_in_url); namespace_, pod_name, 1 == _stdin ? TRUE_STRING : FALSE_STRING, 1 == _stdout ? TRUE_STRING : FALSE_STRING, 1 == tty ? TRUE_STRING : FALSE_STRING, command_string_in_url);
if (container_name && container_name[0] != '\0') { if (container_name && container_name[0] != '\0') {
int length_of_ws_path_with_container = strlen(ws_path) + strlen(CONTAINER_PREFIX) + strlen(container_name); int length_of_ws_path_with_container = strlen(ws_path) + strlen(CONTAINER_PREFIX) + strlen(container_name);