qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Daniel Berrange" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Willian Rampazzo" <willianr@redhat.com>,
	"John Snow" <jsnow@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH 2/6] ui/clipboard: Don't use g_autoptr just to free a variable
Date: Wed,  3 Nov 2021 10:48:40 -0400	[thread overview]
Message-ID: <20211103144844.1285634-3-jsnow@redhat.com> (raw)
In-Reply-To: <20211103144844.1285634-1-jsnow@redhat.com>

Clang doesn't recognize that the variable is being "used" and will emit
a warning:

  ../ui/clipboard.c:47:34: error: variable 'old' set but not used [-Werror,-Wunused-but-set-variable]
      g_autoptr(QemuClipboardInfo) old = NULL;
                                 ^
  1 error generated.

OK, fine. Just do things the old way.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 ui/clipboard.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/clipboard.c b/ui/clipboard.c
index d7b008d62a..d53576b0f6 100644
--- a/ui/clipboard.c
+++ b/ui/clipboard.c
@@ -44,13 +44,14 @@ void qemu_clipboard_peer_release(QemuClipboardPeer *peer,
 
 void qemu_clipboard_update(QemuClipboardInfo *info)
 {
-    g_autoptr(QemuClipboardInfo) old = NULL;
+    QemuClipboardInfo *old = NULL;
     assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);
 
     notifier_list_notify(&clipboard_notifiers, info);
 
     old = cbinfo[info->selection];
     cbinfo[info->selection] = qemu_clipboard_info_ref(info);
+    g_free(old);
 }
 
 QemuClipboardInfo *qemu_clipboard_info(QemuClipboardSelection selection)
-- 
2.31.1



  parent reply	other threads:[~2021-11-03 14:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 14:48 [PATCH 0/6] tests/docker: Update Fedora containers John Snow
2021-11-03 14:48 ` [PATCH 1/6] spice: Update QXLInterface for spice >= 0.15.0 John Snow
2021-11-04  6:47   ` Gerd Hoffmann
2021-11-03 14:48 ` John Snow [this message]
2021-11-03 14:57   ` [PATCH 2/6] ui/clipboard: Don't use g_autoptr just to free a variable Marc-André Lureau
2021-11-03 14:58   ` Daniel P. Berrangé
2021-11-03 15:30     ` John Snow
2021-11-03 14:48 ` [PATCH 3/6] docker: update fedora container to Fedora 34 John Snow
2021-11-03 14:52   ` Philippe Mathieu-Daudé
2021-11-03 16:55   ` Willian Rampazzo
2021-11-03 14:48 ` [PATCH 4/6] docker: update Fedora-based cross-compiler containers " John Snow
2021-11-03 14:52   ` Philippe Mathieu-Daudé
2021-11-03 16:56   ` Willian Rampazzo
2021-11-03 14:48 ` [PATCH 5/6] docker: update 'python' dockerfile to use Fedora registry John Snow
2021-11-03 14:55   ` Philippe Mathieu-Daudé
2021-11-03 16:57   ` Willian Rampazzo
2021-11-03 14:48 ` [PATCH 6/6] docker: Add Fedora 35 container John Snow
2021-11-03 16:59   ` Daniel P. Berrangé
2021-11-03 17:51     ` John Snow
2021-11-03 18:53       ` Philippe Mathieu-Daudé
2021-11-24 12:19 ` [PATCH 0/6] tests/docker: Update Fedora containers Daniel P. Berrangé
2021-11-24 12:34   ` Philippe Mathieu-Daudé
2021-11-24 12:51     ` Alex Bennée
2021-11-24 12:59       ` Philippe Mathieu-Daudé

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=20211103144844.1285634-3-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=kraxel@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    --cc=willianr@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).