X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgears%2Fext_env_inject.c;h=4b7590c46c6d1efb5ce0b75d7e060557a6be5061;hb=e26f7efb461ea8fba7eb0fd14809618c22dd475b;hp=4988dcf24e0883689f4669c7188bc12c081dc397;hpb=7229981629c6baa0afb61cc99cfcf6dd029c9c93;p=palacios.git diff --git a/palacios/src/gears/ext_env_inject.c b/palacios/src/gears/ext_env_inject.c index 4988dcf..4b7590c 100644 --- a/palacios/src/gears/ext_env_inject.c +++ b/palacios/src/gears/ext_env_inject.c @@ -38,13 +38,13 @@ static int v3_env_inject_handler (struct guest_info * core, void * priv_data) { struct v3_env_inject_info * inject = (struct v3_env_inject_info*)priv_data; for (; i < inject->num_env_vars; i++) { - PrintDebug("Envvar[%d]: %s\n", i, inject->env_vars[i]); + PrintDebug(core->vm_info, core, "Envvar[%d]: %s\n", i, inject->env_vars[i]); } int ret = v3_inject_strings(core, (const char**)NULL, (const char**)inject->env_vars, 0, inject->num_env_vars); if (ret == -1) { - PrintDebug("Error injecting strings in v3_env_inject_handler\n"); + PrintDebug(core->vm_info, core, "Error injecting strings in v3_env_inject_handler\n"); return -1; } @@ -75,6 +75,12 @@ int v3_insert_env_inject (void * ginfo, char ** strings, int num_strings, char * struct v3_env_injects * injects = &env_injects; struct v3_env_inject_info * inject = V3_Malloc(sizeof(struct v3_env_inject_info)); + if (!inject) { + PrintError(VM_NONE, VCORE_NONE, "Cannot allocate in inserting environment inject\n"); + return -1; + } + + memset(inject, 0, sizeof(struct v3_env_inject_info)); inject->env_vars = strings; @@ -92,7 +98,7 @@ int v3_insert_env_inject (void * ginfo, char ** strings, int num_strings, char * int v3_remove_env_inject (struct v3_vm_info * vm, struct v3_env_inject_info * inject) { if (v3_unhook_executable(vm, inject->bin_name) < 0) { - PrintError("Problem unhooking executable in v3_remove_env_inject\n"); + PrintError(vm, VCORE_NONE, "Problem unhooking executable in v3_remove_env_inject\n"); return -1; }