From: "Richard W.M. Jones" <rjones@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, jcody@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH] block/ssh: remove dead code
Date: Mon, 14 Sep 2015 12:18:10 +0100 [thread overview]
Message-ID: <20150914111810.GD1406@redhat.com> (raw)
In-Reply-To: <1442229154-2052-1-git-send-email-pbonzini@redhat.com>
On Mon, Sep 14, 2015 at 01:12:34PM +0200, Paolo Bonzini wrote:
> The "err" label cannot be reached with qp != NULL. Remove the free-ing
> of qp and avoid future regressions by removing the initializer.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> block/ssh.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/block/ssh.c b/block/ssh.c
> index 8d06739..d35b51f 100644
> --- a/block/ssh.c
> +++ b/block/ssh.c
> @@ -193,7 +193,7 @@ sftp_error_report(BDRVSSHState *s, const char *fs, ...)
> static int parse_uri(const char *filename, QDict *options, Error **errp)
> {
> URI *uri = NULL;
> - QueryParams *qp = NULL;
> + QueryParams *qp;
> int i;
>
> uri = uri_parse(filename);
> @@ -249,9 +249,6 @@ static int parse_uri(const char *filename, QDict *options, Error **errp)
> return 0;
>
> err:
> - if (qp) {
> - query_params_free(qp);
> - }
> if (uri) {
> uri_free(uri);
> }
The patch looks correct to me, so:
ACK
However (in libguestfs) we would generally leave such code around to
make it more future proof against rearrangements of the code which
could cause a memory leak. But then again, libguestfs (following
systemd practice) uses __attribute__((cleanup)) extensively ...
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
WARNING: multiple messages have this Message-ID (diff)
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, jcody@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block/ssh: remove dead code
Date: Mon, 14 Sep 2015 12:18:10 +0100 [thread overview]
Message-ID: <20150914111810.GD1406@redhat.com> (raw)
In-Reply-To: <1442229154-2052-1-git-send-email-pbonzini@redhat.com>
On Mon, Sep 14, 2015 at 01:12:34PM +0200, Paolo Bonzini wrote:
> The "err" label cannot be reached with qp != NULL. Remove the free-ing
> of qp and avoid future regressions by removing the initializer.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> block/ssh.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/block/ssh.c b/block/ssh.c
> index 8d06739..d35b51f 100644
> --- a/block/ssh.c
> +++ b/block/ssh.c
> @@ -193,7 +193,7 @@ sftp_error_report(BDRVSSHState *s, const char *fs, ...)
> static int parse_uri(const char *filename, QDict *options, Error **errp)
> {
> URI *uri = NULL;
> - QueryParams *qp = NULL;
> + QueryParams *qp;
> int i;
>
> uri = uri_parse(filename);
> @@ -249,9 +249,6 @@ static int parse_uri(const char *filename, QDict *options, Error **errp)
> return 0;
>
> err:
> - if (qp) {
> - query_params_free(qp);
> - }
> if (uri) {
> uri_free(uri);
> }
The patch looks correct to me, so:
ACK
However (in libguestfs) we would generally leave such code around to
make it more future proof against rearrangements of the code which
could cause a memory leak. But then again, libguestfs (following
systemd practice) uses __attribute__((cleanup)) extensively ...
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
next prev parent reply other threads:[~2015-09-14 11:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-14 11:12 [Qemu-trivial] [PATCH] block/ssh: remove dead code Paolo Bonzini
2015-09-14 11:12 ` [Qemu-devel] " Paolo Bonzini
2015-09-14 11:18 ` Richard W.M. Jones [this message]
2015-09-14 11:18 ` Richard W.M. Jones
2015-09-15 2:31 ` [Qemu-trivial] " Fam Zheng
2015-09-15 2:31 ` Fam Zheng
2015-09-16 10:29 ` [Qemu-trivial] " Michael Tokarev
2015-09-16 10:29 ` [Qemu-devel] " Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150914111810.GD1406@redhat.com \
--to=rjones@redhat.com \
--cc=jcody@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.