[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] net/colo-compare.c: Fix memory leak and code st
From: |
Zhang, Chen |
Subject: |
Re: [Qemu-devel] [PATCH] net/colo-compare.c: Fix memory leak and code style issue. |
Date: |
Thu, 4 Jul 2019 03:44:11 +0000 |
> -----Original Message-----
> From: Philippe Mathieu-Daudé [mailto:address@hidden]
> Sent: Wednesday, July 3, 2019 4:56 PM
> To: Zhang, Chen <address@hidden>; Li Zhijian <address@hidden>;
> Peter Maydell <address@hidden>; Jason Wang
> <address@hidden>; qemu-dev <address@hidden>
> Cc: Zhang Chen <address@hidden>
> Subject: Re: [Qemu-devel] [PATCH] net/colo-compare.c: Fix memory leak and
> code style issue.
>
> On 7/3/19 3:38 AM, Zhang Chen wrote:
> > From: Zhang Chen <address@hidden>
> >
> > Address Peter's comments in patch "COLO-compare:Add colo-compare
> > remote notify support".
>
> This comment is not useful in the git history (no reference).
>
> You might reword him, use full coment, or simply:
>
> Reported-by: Coverity (CID 1402785)
OK, I will fix it in next version.
Thanks
Zhang Chen
>
> > Signed-off-by: Zhang Chen <address@hidden>
> > ---
> > net/colo-compare.c | 13 ++++++-------
> > 1 file changed, 6 insertions(+), 7 deletions(-)
> >
> > diff --git a/net/colo-compare.c b/net/colo-compare.c index
> > 909dd6c6eb..363b1edd11 100644
> > --- a/net/colo-compare.c
> > +++ b/net/colo-compare.c
> > @@ -1008,21 +1008,20 @@ static void
> > compare_notify_rs_finalize(SocketReadState *notify_rs) {
> > CompareState *s = container_of(notify_rs, CompareState,
> > notify_rs);
> >
> > - /* Get Xen colo-frame's notify and handle the message */
> > - char *data = g_memdup(notify_rs->buf, notify_rs->packet_len);
> > - char msg[] = "COLO_COMPARE_GET_XEN_INIT";
> > + const char msg[] = "COLO_COMPARE_GET_XEN_INIT";
> > int ret;
> >
> > - if (!strcmp(data, "COLO_USERSPACE_PROXY_INIT")) {
> > + if (!strcmp((char *)notify_rs->buf, "COLO_USERSPACE_PROXY_INIT"))
> > + {
> > ret = compare_chr_send(s, (uint8_t *)msg, strlen(msg), 0, true);
> > if (ret < 0) {
> > error_report("Notify Xen COLO-frame INIT failed");
> > }
> > - }
> > -
> > - if (!strcmp(data, "COLO_CHECKPOINT")) {
> > + } else if (!strcmp((char *)notify_rs->buf, "COLO_CHECKPOINT")) {
> > /* colo-compare do checkpoint, flush pri packet and remove sec
> > packet
> */
> > g_queue_foreach(&s->conn_list, colo_flush_packets, s);
> > + } else {
> > + error_report("COLO compare got unsupported instruction '%s'",
> > + (char *)notify_rs->buf);
> > }
> > }
> >
> >
- [Qemu-devel] [PATCH] net/colo-compare.c: Fix memory leak and code style issue., Zhang Chen, 2019/07/02
- Re: [Qemu-devel] [PATCH] net/colo-compare.c: Fix memory leak and code style issue., no-reply, 2019/07/03
- Re: [Qemu-devel] [PATCH] net/colo-compare.c: Fix memory leak and code style issue., Philippe Mathieu-Daudé, 2019/07/03
- Re: [Qemu-devel] [PATCH] net/colo-compare.c: Fix memory leak and code style issue.,
Zhang, Chen <=
- Re: [Qemu-devel] [PATCH] net/colo-compare.c: Fix memory leak and code style issue., no-reply, 2019/07/03
- Re: [Qemu-devel] [PATCH] net/colo-compare.c: Fix memory leak and code style issue., Peter Maydell, 2019/07/03