Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Initialize `location' in gdbpy_decode_line
@ 2015-08-12 17:38 Keith Seitz
  2015-08-12 17:46 ` Doug Evans
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2015-08-12 17:38 UTC (permalink / raw)
  To: gdb-patches

BuildBot flagged an uninitialized variable coming from one of the patches
in my recently committed locations/explicit patchset.

The following patch fixes this.

Ok?

gdb/ChangeLog

	* python/python.c (gdbpy_decode_line): Initialize `location' to NULL
	and only call decode_line_1 when it is non-NULL.

diff --git a/gdb/python/python.c b/gdb/python/python.c
index c28f98b..14da62c 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -730,7 +730,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
   PyObject *result = NULL;
   PyObject *return_result = NULL;
   PyObject *unparsed = NULL;
-  struct event_location *location;
+  struct event_location *location = NULL;
 
   if (! PyArg_ParseTuple (args, "|s", &arg))
     return NULL;
@@ -747,7 +747,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
 
   TRY
     {
-      if (arg)
+      if (location != NULL)
 	sals = decode_line_1 (location, 0, 0, 0);
       else
 	{


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Initialize `location' in gdbpy_decode_line
  2015-08-12 17:38 [PATCH] Initialize `location' in gdbpy_decode_line Keith Seitz
@ 2015-08-12 17:46 ` Doug Evans
  2015-08-12 18:32   ` Keith Seitz
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Evans @ 2015-08-12 17:46 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches

On Wed, Aug 12, 2015 at 10:38 AM, Keith Seitz <keiths@redhat.com> wrote:
> BuildBot flagged an uninitialized variable coming from one of the patches
> in my recently committed locations/explicit patchset.
>
> The following patch fixes this.
>
> Ok?
>
> gdb/ChangeLog
>
>         * python/python.c (gdbpy_decode_line): Initialize `location' to NULL
>         and only call decode_line_1 when it is non-NULL.
>
> diff --git a/gdb/python/python.c b/gdb/python/python.c
> index c28f98b..14da62c 100644
> --- a/gdb/python/python.c
> +++ b/gdb/python/python.c
> @@ -730,7 +730,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
>    PyObject *result = NULL;
>    PyObject *return_result = NULL;
>    PyObject *unparsed = NULL;
> -  struct event_location *location;
> +  struct event_location *location = NULL;
>
>    if (! PyArg_ParseTuple (args, "|s", &arg))
>      return NULL;
> @@ -747,7 +747,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
>
>    TRY
>      {
> -      if (arg)
> +      if (location != NULL)
>         sals = decode_line_1 (location, 0, 0, 0);
>        else
>         {

LGTM


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Initialize `location' in gdbpy_decode_line
  2015-08-12 17:46 ` Doug Evans
@ 2015-08-12 18:32   ` Keith Seitz
  0 siblings, 0 replies; 3+ messages in thread
From: Keith Seitz @ 2015-08-12 18:32 UTC (permalink / raw)
  To: gdb-patches

On 08/12/2015 10:45 AM, Doug Evans wrote:
> On Wed, Aug 12, 2015 at 10:38 AM, Keith Seitz <keiths@redhat.com> wrote:
>> BuildBot flagged an uninitialized variable coming from one of the patches
>> in my recently committed locations/explicit patchset.
>>
>> The following patch fixes this.
>>
>> Ok?
>>
>> gdb/ChangeLog
>>
>>         * python/python.c (gdbpy_decode_line): Initialize `location' to NULL
>>         and only call decode_line_1 when it is non-NULL.
>>
> 
> LGTM
> 

I've pushed this. Thank you, Doug.

Keith


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-12 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-12 17:38 [PATCH] Initialize `location' in gdbpy_decode_line Keith Seitz
2015-08-12 17:46 ` Doug Evans
2015-08-12 18:32   ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox