* [PATCH v2] sim: Be sure of calling freeargv() after successfully call buildargv().
@ 2015-02-02 20:08 Chen Gang S
2015-02-02 20:09 ` Chen Gang S
0 siblings, 1 reply; 5+ messages in thread
From: Chen Gang S @ 2015-02-02 20:08 UTC (permalink / raw)
To: gdb-patches, Michael Eager
Or there will be memory leak.
2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
* microblaze/interp.c (sim_do_command): Call freeargv() before
return.
---
sim/ChangeLog | 5 +++++
sim/microblaze/interp.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/sim/ChangeLog b/sim/ChangeLog
index 1fe93df..582bd4a 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,5 +1,10 @@
2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
+ * microblaze/interp.c (sim_do_command): Call freeargv() before
+ return.
+
+2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
+
* mcore/interp.c (sim_do_command): Call freeargv() before return.
2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
index 1c8a22d..4fc4595 100644
--- a/sim/microblaze/interp.c
+++ b/sim/microblaze/interp.c
@@ -1019,6 +1019,7 @@ sim_do_command (SIM_DESC sd, const char *cmd)
if ((simargv[1] == NULL) || (simargv[2] == NULL))
{
fprintf (stderr, "Error: missing argument to watch cmd.\n");
+ freeargv (simargv);
return;
}
@@ -1062,6 +1063,8 @@ sim_do_command (SIM_DESC sd, const char *cmd)
fprintf (stderr,"Error: \"%s\" is not a valid M.CORE simulator command.\n",
cmd);
}
+
+ freeargv (simargv);
}
else
{
--
1.9.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] sim: Be sure of calling freeargv() after successfully call buildargv().
2015-02-02 20:08 [PATCH v2] sim: Be sure of calling freeargv() after successfully call buildargv() Chen Gang S
@ 2015-02-02 20:09 ` Chen Gang S
2015-02-02 20:16 ` Michael Eager
0 siblings, 1 reply; 5+ messages in thread
From: Chen Gang S @ 2015-02-02 20:09 UTC (permalink / raw)
To: gdb-patches, Michael Eager
If there will be no any additional reply within this week, I shall apply
the related 3 patches to main branch.
Thanks.
On 2/3/15 04:15, Chen Gang S wrote:
> Or there will be memory leak.
>
> 2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
>
> * microblaze/interp.c (sim_do_command): Call freeargv() before
> return.
> ---
> sim/ChangeLog | 5 +++++
> sim/microblaze/interp.c | 3 +++
> 2 files changed, 8 insertions(+)
>
> diff --git a/sim/ChangeLog b/sim/ChangeLog
> index 1fe93df..582bd4a 100644
> --- a/sim/ChangeLog
> +++ b/sim/ChangeLog
> @@ -1,5 +1,10 @@
> 2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
>
> + * microblaze/interp.c (sim_do_command): Call freeargv() before
> + return.
> +
> +2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
> +
> * mcore/interp.c (sim_do_command): Call freeargv() before return.
>
> 2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
> diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
> index 1c8a22d..4fc4595 100644
> --- a/sim/microblaze/interp.c
> +++ b/sim/microblaze/interp.c
> @@ -1019,6 +1019,7 @@ sim_do_command (SIM_DESC sd, const char *cmd)
> if ((simargv[1] == NULL) || (simargv[2] == NULL))
> {
> fprintf (stderr, "Error: missing argument to watch cmd.\n");
> + freeargv (simargv);
> return;
> }
>
> @@ -1062,6 +1063,8 @@ sim_do_command (SIM_DESC sd, const char *cmd)
> fprintf (stderr,"Error: \"%s\" is not a valid M.CORE simulator command.\n",
> cmd);
> }
> +
> + freeargv (simargv);
> }
> else
> {
>
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] sim: Be sure of calling freeargv() after successfully call buildargv().
2015-02-02 20:09 ` Chen Gang S
@ 2015-02-02 20:16 ` Michael Eager
2015-02-02 20:22 ` Chen Gang S
0 siblings, 1 reply; 5+ messages in thread
From: Michael Eager @ 2015-02-02 20:16 UTC (permalink / raw)
To: Chen Gang S, gdb-patches
On 02/02/15 12:16, Chen Gang S wrote:
>
> If there will be no any additional reply within this week, I shall apply
> the related 3 patches to main branch.
>
> Thanks.
>
> On 2/3/15 04:15, Chen Gang S wrote:
>> Or there will be memory leak.
>>
>> 2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
>>
>> * microblaze/interp.c (sim_do_command): Call freeargv() before
OK to apply.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] sim: Be sure of calling freeargv() after successfully call buildargv().
2015-02-02 20:16 ` Michael Eager
@ 2015-02-02 20:22 ` Chen Gang S
0 siblings, 0 replies; 5+ messages in thread
From: Chen Gang S @ 2015-02-02 20:22 UTC (permalink / raw)
To: Michael Eager, gdb-patches
On 2/3/15 04:16, Michael Eager wrote:
> On 02/02/15 12:16, Chen Gang S wrote:
>>
>> If there will be no any additional reply within this week, I shall apply
>> the related 3 patches to main branch.
>>
>> Thanks.
>>
>> On 2/3/15 04:15, Chen Gang S wrote:
>>> Or there will be memory leak.
>>>
>>> 2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
>>>
>>> * microblaze/interp.c (sim_do_command): Call freeargv() before
>
> OK to apply.
>
OK, thank. Finish "git push" for the related 3 patches.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] sim: Be sure of calling freeargv() after successfully call buildargv().
@ 2015-02-02 20:06 Chen Gang S
0 siblings, 0 replies; 5+ messages in thread
From: Chen Gang S @ 2015-02-02 20:06 UTC (permalink / raw)
To: gdb-patches
Or there will be memory leak.
2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
* mcore/interp.c (sim_do_command): Call freeargv() before return.
---
sim/ChangeLog | 4 ++++
sim/mcore/interp.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/sim/ChangeLog b/sim/ChangeLog
index 7153c6a..1fe93df 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,5 +1,9 @@
2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
+ * mcore/interp.c (sim_do_command): Call freeargv() before return.
+
+2015-02-02 Chen Gang <gang.chen.5i5j@gmail.com>
+
* common/sim-options.c (sim_args_command): Call freeargv() when
failure occurs.
diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c
index d2edd12..dfaa6aa 100644
--- a/sim/mcore/interp.c
+++ b/sim/mcore/interp.c
@@ -2143,6 +2143,7 @@ sim_do_command (sd, cmd)
if ((simargv[1] == NULL) || (simargv[2] == NULL))
{
fprintf (stderr, "Error: missing argument to watch cmd.\n");
+ freeargv (simargv);
return;
}
@@ -2187,6 +2188,8 @@ sim_do_command (sd, cmd)
fprintf (stderr,"Error: \"%s\" is not a valid M.CORE simulator command.\n",
cmd);
}
+
+ freeargv (simargv);
}
else
{
--
1.9.3
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-02-02 20:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-02 20:08 [PATCH v2] sim: Be sure of calling freeargv() after successfully call buildargv() Chen Gang S
2015-02-02 20:09 ` Chen Gang S
2015-02-02 20:16 ` Michael Eager
2015-02-02 20:22 ` Chen Gang S
-- strict thread matches above, loose matches on Subject: below --
2015-02-02 20:06 Chen Gang S
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox