[02/17] linux-user: target_argv is placed on ts->bprm->argv and can't be freed()

Submitted by riku.voipio@linaro.org on April 6, 2012, 4:35 p.m.

Details

Message ID 84803b87a183bd71963584c3be5ca838d32c55df.1333729958.git.riku.voipio@linaro.org
State New
Headers show

Commit Message

riku.voipio@linaro.org April 6, 2012, 4:35 p.m.
From: Fabio Erculiani <lxnay@sabayon.org>

TaskState contains linux_bprm struct which encapsulates argv among
other things.
argv might be used around the code and is expected to contain valid
data. Before this patch, ts->bprm->argv was NULL due to it being
freed right after loader_exec().

Signed-off-by: Fabio Erculiani <lxnay@sabayon.org>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 linux-user/main.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/linux-user/main.c b/linux-user/main.c
index 962677e..2570140 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3486,11 +3486,6 @@  int main(int argc, char **argv, char **envp)
         _exit(1);
     }
 
-    for (i = 0; i < target_argc; i++) {
-        free(target_argv[i]);
-    }
-    free(target_argv);
-
     for (wrk = target_environ; *wrk; wrk++) {
         free(*wrk);
     }