char *envp_plugin = NULL;
envp_plugin = malloc(ENV_BUF_MAX);
if (envp_plugin == NULL) {
- E("Cannot allocate the shell commnad buffer.");
+ E("Cannot allocate the shell command buffer.");
+ /* free environment variables */
+ int i = 0;
+ if(envp_cnt > 0) {
+ for(i = 0; i < envp_cnt; i++) {
+ if(envp[i]) {
+ D("envp[%d] = %s\n", i, envp[i]);
+ free(envp[i]);
+ }
+ }
+ }
return -1;
}
memset(envp_plugin, 0, ENV_BUF_MAX);
envp_plugin, ENV_BUF_MAX)) {
E("Failed to convert the shell command. (%s)\n", name);
free(envp_plugin);
+ /* free environment variables */
+ int i = 0;
+ if(envp_cnt > 0) {
+ for(i = 0; i < envp_cnt; i++) {
+ if(envp[i]) {
+ D("envp[%d] = %s\n", i, envp[i]);
+ free(envp[i]);
+ }
+ }
+ }
return -1;
} else {
if(envp_plugin[0] != '\0') {
// Check the shell command validation.
if (!request_validity_to_plugin(PLUGIN_SYNC_CMD_VERIFY_SHELLCMD, name)) {
E("This shell command is invalid. (%s)\n", name);
+ /* free environment variables */
+ int i = 0;
+ if(envp_cnt > 0) {
+ for(i = 0; i < envp_cnt; i++) {
+ if(envp[i]) {
+ D("envp[%d] = %s\n", i, envp[i]);
+ free(envp[i]);
+ }
+ }
+ }
return -1;
}
new_cmd = malloc(SDBD_SHELL_CMD_MAX);
if(new_cmd == NULL) {
E("Cannot allocate the shell commnad buffer.");
+ /* free environment variables */
+ int i = 0;
+ if(envp_cnt > 0) {
+ for(i = 0; i < envp_cnt; i++) {
+ if(envp[i]) {
+ D("envp[%d] = %s\n", i, envp[i]);
+ free(envp[i]);
+ }
+ }
+ }
return -1;
}
if(!request_conversion_to_plugin(PLUGIN_SYNC_CMD_CONVERT_SHELLCMD, name, new_cmd, SDBD_SHELL_CMD_MAX)) {
E("Failed to convert the shell command. (%s)\n", name);
free(new_cmd);
+ /* free environment variables */
+ int i = 0;
+ if(envp_cnt > 0) {
+ for(i = 0; i < envp_cnt; i++) {
+ if(envp[i]) {
+ D("envp[%d] = %s\n", i, envp[i]);
+ free(envp[i]);
+ }
+ }
+ }
return -1;
}
// Check the capability for interactive shell support.
if (!is_support_interactive_shell()) {
E("This platform dose NOT support the interactive shell\n");
+ /* free environment variables */
+ int i = 0;
+ if(envp_cnt > 0) {
+ for(i = 0; i < envp_cnt; i++) {
+ if(envp[i]) {
+ D("envp[%d] = %s\n", i, envp[i]);
+ free(envp[i]);
+ }
+ }
+ }
return -1;
}
// tell sdb server emulator's vms name
// TODO: should we use host:emulator request? let's talk about this!
-
- if (!strncmp(host_ip, QEMU_FORWARD_IP, sizeof host_ip)) {
+ if (!strncmp(host_ip, QEMU_FORWARD_IP, strlen(QEMU_FORWARD_IP)+1)) {
snprintf(request, sizeof request, "host:emulator:%d:%s", (emulator_port + 1), vm_name);
} else {
snprintf(request, sizeof request, "host:connect:%s:%d", guest_ip, DEFAULT_SDB_LOCAL_TRANSPORT_PORT);