This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Use rs->buf after getpkt
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 04 Feb 2014 19:25:50 +0000
- Subject: Re: [PATCH] Use rs->buf after getpkt
- Authentication-results: sourceware.org; auth=none
- References: <1390652193-6018-1-git-send-email-yao at codesourcery dot com>
On 01/25/2014 12:16 PM, Yao Qi wrote:
> Hi,
> The following code snippet looks wrong to me
>
> char *buf = rs->buf;
>
> getpkt (&rs->buf, &rs->buf_size, 0);
> packet_ok (buf, );
>
> if rs->buf is reallocated in getpkt, buf points to an out of dated
> memory.
Indeed.
> This patch removes local 'buf' and uses rs->buf.
>
> Regression tested on x86_64-linux. Is it OK?
OK.
--
Pedro Alves