[Spice-commits] 11 commits - audio/alsaaudio.c audio/audio_template.h audio/ossaudio.c hw/audio hw/display hw/usb include/ui qemu-char.c ui/spice-display.c util/qemu-sockets.c

Gerd Hoffmann kraxel at kemper.freedesktop.org
Mon Jun 16 06:18:57 PDT 2014


 audio/alsaaudio.c          |   12 +---
 audio/audio_template.h     |   15 +----
 audio/ossaudio.c           |    6 --
 hw/audio/adlib.c           |    4 -
 hw/display/qxl-render.c    |    6 ++
 hw/display/qxl.c           |    6 +-
 hw/usb/host-libusb.c       |   13 ++++
 include/ui/spice-display.h |   14 ++++
 qemu-char.c                |    8 ++
 ui/spice-display.c         |  129 +++++++++++++++++++++++++++++++++++++++++----
 util/qemu-sockets.c        |   15 ++++-
 11 files changed, 187 insertions(+), 41 deletions(-)

New commits:
commit 06a59afac4505f5ed942db4200e5ca16fcbba74d
Merge: 80008a6 f3cda6e
Author: Peter Maydell <peter.maydell at linaro.org>
Date:   Fri Jun 13 18:18:55 2014 +0100

    Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20140613-1' into staging
    
    usb-host: add range checks for usb-host parameters
    
    # gpg: Signature made Fri 13 Jun 2014 12:33:05 BST using RSA key ID D3E87138
    # gpg: Good signature from "Gerd Hoffmann (work) <kraxel at redhat.com>"
    # gpg:                 aka "Gerd Hoffmann <gerd at kraxel.org>"
    # gpg:                 aka "Gerd Hoffmann (private) <kraxel at gmail.com>"
    
    * remotes/kraxel/tags/pull-usb-20140613-1:
      usb-host: add range checks for usb-host parameters
    
    Signed-off-by: Peter Maydell <peter.maydell at linaro.org>

commit 80008a6a298104e25d1b806b673eccc5ff58d1aa
Merge: 592fb17 8bc8912
Author: Peter Maydell <peter.maydell at linaro.org>
Date:   Fri Jun 13 16:07:04 2014 +0100

    Merge remote-tracking branch 'remotes/kraxel/tags/pull-trivial-20140613-1' into staging
    
    inet_listen_opts: add error checking
    
    # gpg: Signature made Fri 13 Jun 2014 12:29:43 BST using RSA key ID D3E87138
    # gpg: Good signature from "Gerd Hoffmann (work) <kraxel at redhat.com>"
    # gpg:                 aka "Gerd Hoffmann <gerd at kraxel.org>"
    # gpg:                 aka "Gerd Hoffmann (private) <kraxel at gmail.com>"
    
    * remotes/kraxel/tags/pull-trivial-20140613-1:
      inet_listen_opts: add error checking
    
    Signed-off-by: Peter Maydell <peter.maydell at linaro.org>

commit 592fb17691e03606ad16e36a4d52d1818721f4cd
Merge: 7d5bef0 788fbf0
Author: Peter Maydell <peter.maydell at linaro.org>
Date:   Fri Jun 13 15:15:31 2014 +0100

    Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20140613-1' into staging
    
    spice: add mouse cursor support
    qxl-render: add sanity check
    
    # gpg: Signature made Fri 13 Jun 2014 12:22:45 BST using RSA key ID D3E87138
    # gpg: Good signature from "Gerd Hoffmann (work) <kraxel at redhat.com>"
    # gpg:                 aka "Gerd Hoffmann <gerd at kraxel.org>"
    # gpg:                 aka "Gerd Hoffmann (private) <kraxel at gmail.com>"
    
    * remotes/spice/tags/pull-spice-20140613-1:
      qxl-render: add sanity check
      spice: add mouse cursor support
    
    Signed-off-by: Peter Maydell <peter.maydell at linaro.org>

commit 7d5bef0873abdc336c7e9f4e2ddbf30f7348342e
Merge: d61de72 e9d21c4
Author: Peter Maydell <peter.maydell at linaro.org>
Date:   Fri Jun 13 14:57:56 2014 +0100

    Merge remote-tracking branch 'remotes/kraxel/tags/pull-chardev-20140613-1' into staging
    
    char: fix avail_connections init in qemu_chr_open_eventfd()
    
    # gpg: Signature made Fri 13 Jun 2014 12:16:50 BST using RSA key ID D3E87138
    # gpg: Good signature from "Gerd Hoffmann (work) <kraxel at redhat.com>"
    # gpg:                 aka "Gerd Hoffmann <gerd at kraxel.org>"
    # gpg:                 aka "Gerd Hoffmann (private) <kraxel at gmail.com>"
    
    * remotes/kraxel/tags/pull-chardev-20140613-1:
      char: fix avail_connections init in qemu_chr_open_eventfd()
    
    Signed-off-by: Peter Maydell <peter.maydell at linaro.org>

commit d61de7255b707f726447d3ed7459e18e0a4fab5b
Merge: 2a2c483 fb7da62
Author: Peter Maydell <peter.maydell at linaro.org>
Date:   Fri Jun 13 12:58:24 2014 +0100

    Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20140613-1' into staging
    
    audio: Drop superfluous conditionals around g_free()
    
    # gpg: Signature made Fri 13 Jun 2014 12:14:24 BST using RSA key ID D3E87138
    # gpg: Good signature from "Gerd Hoffmann (work) <kraxel at redhat.com>"
    # gpg:                 aka "Gerd Hoffmann <gerd at kraxel.org>"
    # gpg:                 aka "Gerd Hoffmann (private) <kraxel at gmail.com>"
    
    * remotes/kraxel/tags/pull-audio-20140613-1:
      audio: Drop superfluous conditionals around g_free()
    
    Signed-off-by: Peter Maydell <peter.maydell at linaro.org>

commit f3cda6e060c483dee1fa497699fd5f972e5031da
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Dec 12 14:47:15 2013 +0100

    usb-host: add range checks for usb-host parameters
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index afbf156..33b5b9f 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -952,6 +952,19 @@ static int usb_host_initfn(USBDevice *udev)
 {
     USBHostDevice *s = USB_HOST_DEVICE(udev);
 
+    if (s->match.vendor_id > 0xffff) {
+        error_report("vendorid out of range");
+        return -1;
+    }
+    if (s->match.product_id > 0xffff) {
+        error_report("productid out of range");
+        return -1;
+    }
+    if (s->match.addr > 127) {
+        error_report("hostaddr out of range");
+        return -1;
+    }
+
     loglevel = s->loglevel;
     udev->flags |= (1 << USB_DEV_FLAG_IS_HOST);
     udev->auto_attach = 0;
commit 8bc891279604186562f59a4239e42dcb451c60d3
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Wed Dec 11 12:58:41 2013 +0100

    inet_listen_opts: add error checking
    
    Don't use atoi() function which doesn't detect errors, switch to
    strtol and error out on failures.  Also add a range check while
    being at it.
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
    Reviewed-by: Markus Armbruster <armbru at redhat.com>

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index e3d29ee..a4a1e9d 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -131,8 +131,19 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
         ai.ai_family = PF_INET6;
 
     /* lookup */
-    if (port_offset)
-        snprintf(port, sizeof(port), "%d", atoi(port) + port_offset);
+    if (port_offset) {
+        unsigned long long baseport;
+        if (parse_uint_full(port, &baseport, 10) < 0) {
+            error_setg(errp, "can't convert to a number: %s", port);
+            return -1;
+        }
+        if (baseport > 65535 ||
+            baseport + port_offset > 65535) {
+            error_setg(errp, "port %s out of range", port);
+            return -1;
+        }
+        snprintf(port, sizeof(port), "%d", (int)baseport + port_offset);
+    }
     rc = getaddrinfo(strlen(addr) ? addr : NULL, port, &ai, &res);
     if (rc != 0) {
         error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
commit 788fbf042fc6d5aaeab56757e6dad622ac5f0c21
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Tue Jun 10 13:51:12 2014 +0200

    qxl-render: add sanity check
    
    Verify dirty rectangle is completely within the primary surface,
    just ignore it in case it isn't.
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
index 84f1367..cc2c2b1 100644
--- a/hw/display/qxl-render.c
+++ b/hw/display/qxl-render.c
@@ -138,6 +138,12 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)
         if (qemu_spice_rect_is_empty(qxl->dirty+i)) {
             break;
         }
+        if (qxl->dirty[i].left > qxl->dirty[i].right ||
+            qxl->dirty[i].top > qxl->dirty[i].bottom ||
+            qxl->dirty[i].right > qxl->guest_primary.surface.width ||
+            qxl->dirty[i].bottom > qxl->guest_primary.surface.height) {
+            continue;
+        }
         qxl_blit(qxl, qxl->dirty+i);
         dpy_gfx_update(vga->con,
                        qxl->dirty[i].left, qxl->dirty[i].top,
commit 5643fc012c2b7335eda43db90bd1e64d912428b0
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Sat Jun 7 13:03:10 2014 +0200

    spice: add mouse cursor support
    
    So you'll have a mouse pointer when running non-qxl gfx cards with
    mouse pointer support (virtio-gpu, IIRC vmware too).
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 7fb83e4..736fd3c 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -710,7 +710,11 @@ static void interface_release_resource(QXLInstance *sin,
 
     if (ext.group_id == MEMSLOT_GROUP_HOST) {
         /* host group -> vga mode update request */
-        qemu_spice_destroy_update(&qxl->ssd, (void *)(intptr_t)ext.info->id);
+        QXLCommandExt *cmdext = (void *)(ext.info->id);
+        SimpleSpiceUpdate *update;
+        g_assert(cmdext->cmd.type == QXL_CMD_DRAW);
+        update = container_of(cmdext, SimpleSpiceUpdate, ext);
+        qemu_spice_destroy_update(&qxl->ssd, update);
         return;
     }
 
diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h
index a46bc80..4252ab8 100644
--- a/include/ui/spice-display.h
+++ b/include/ui/spice-display.h
@@ -69,6 +69,7 @@ QXLCookie *qxl_cookie_new(int type, uint64_t io);
 
 typedef struct SimpleSpiceDisplay SimpleSpiceDisplay;
 typedef struct SimpleSpiceUpdate SimpleSpiceUpdate;
+typedef struct SimpleSpiceCursor SimpleSpiceCursor;
 
 struct SimpleSpiceDisplay {
     DisplaySurface *ds;
@@ -92,6 +93,13 @@ struct SimpleSpiceDisplay {
      */
     QemuMutex lock;
     QTAILQ_HEAD(, SimpleSpiceUpdate) updates;
+
+    /* cursor (without qxl): displaychangelistener -> spice server */
+    SimpleSpiceCursor *ptr_define;
+    SimpleSpiceCursor *ptr_move;
+    uint16_t ptr_x, ptr_y;
+
+    /* cursor (with qxl): qxl local renderer -> displaychangelistener */
     QEMUCursor *cursor;
     int mouse_x, mouse_y;
 };
@@ -104,6 +112,12 @@ struct SimpleSpiceUpdate {
     QTAILQ_ENTRY(SimpleSpiceUpdate) next;
 };
 
+struct SimpleSpiceCursor {
+    QXLCursorCmd cmd;
+    QXLCommandExt ext;
+    QXLCursor cursor;
+};
+
 int qemu_spice_rect_is_empty(const QXLRect* r);
 void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r);
 
diff --git a/ui/spice-display.c b/ui/spice-display.c
index ce6b220..03040b1 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -153,7 +153,7 @@ static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd,
     drawable->bbox            = *rect;
     drawable->clip.type       = SPICE_CLIP_TYPE_NONE;
     drawable->effect          = QXL_EFFECT_OPAQUE;
-    drawable->release_info.id = (uintptr_t)update;
+    drawable->release_info.id = (uintptr_t)(&update->ext);
     drawable->type            = QXL_DRAW_COPY;
     drawable->surfaces_dest[0] = -1;
     drawable->surfaces_dest[1] = -1;
@@ -264,6 +264,49 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
     memset(&ssd->dirty, 0, sizeof(ssd->dirty));
 }
 
+static SimpleSpiceCursor*
+qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd,
+                                QEMUCursor *c)
+{
+    size_t size = c ? c->width * c->height * 4 : 0;
+    SimpleSpiceCursor *update;
+    QXLCursorCmd *ccmd;
+    QXLCursor *cursor;
+    QXLCommand *cmd;
+
+    update   = g_malloc0(sizeof(*update) + size);
+    ccmd     = &update->cmd;
+    cursor   = &update->cursor;
+    cmd      = &update->ext.cmd;
+
+    if (c) {
+        ccmd->type = QXL_CURSOR_SET;
+        ccmd->u.set.position.x = ssd->ptr_x;
+        ccmd->u.set.position.y = ssd->ptr_y;
+        ccmd->u.set.visible    = true;
+        ccmd->u.set.shape      = (uintptr_t)cursor;
+        cursor->header.unique     = ssd->unique++;
+        cursor->header.type       = SPICE_CURSOR_TYPE_ALPHA;
+        cursor->header.width      = c->width;
+        cursor->header.height     = c->height;
+        cursor->header.hot_spot_x = c->hot_x;
+        cursor->header.hot_spot_y = c->hot_y;
+        cursor->data_size         = size;
+        cursor->chunk.data_size   = size;
+        memcpy(cursor->chunk.data, c->data, size);
+    } else {
+        ccmd->type = QXL_CURSOR_MOVE;
+        ccmd->u.position.x = ssd->ptr_x;
+        ccmd->u.position.y = ssd->ptr_y;
+    }
+    ccmd->release_info.id = (uintptr_t)(&update->ext);
+
+    cmd->type = QXL_CMD_CURSOR;
+    cmd->data = (uintptr_t)ccmd;
+
+    return update;
+}
+
 /*
  * Called from spice server thread context (via interface_release_resource)
  * We do *not* hold the global qemu mutex here, so extra care is needed
@@ -483,20 +526,50 @@ static int interface_req_cmd_notification(QXLInstance *sin)
 }
 
 static void interface_release_resource(QXLInstance *sin,
-                                       struct QXLReleaseInfoExt ext)
+                                       struct QXLReleaseInfoExt rext)
 {
     SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
-    uintptr_t id;
+    SimpleSpiceUpdate *update;
+    SimpleSpiceCursor *cursor;
+    QXLCommandExt *ext;
 
     dprint(2, "%s/%d:\n", __func__, ssd->qxl.id);
-    id = ext.info->id;
-    qemu_spice_destroy_update(ssd, (void*)id);
+    ext = (void *)(rext.info->id);
+    switch (ext->cmd.type) {
+    case QXL_CMD_DRAW:
+        update = container_of(ext, SimpleSpiceUpdate, ext);
+        qemu_spice_destroy_update(ssd, update);
+        break;
+    case QXL_CMD_CURSOR:
+        cursor = container_of(ext, SimpleSpiceCursor, ext);
+        g_free(cursor);
+        break;
+    default:
+        g_assert_not_reached();
+    }
 }
 
 static int interface_get_cursor_command(QXLInstance *sin, struct QXLCommandExt *ext)
 {
-    dprint(3, "%s:\n", __FUNCTION__);
-    return false;
+    SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
+    int ret;
+
+    dprint(3, "%s/%d:\n", __func__, ssd->qxl.id);
+
+    qemu_mutex_lock(&ssd->lock);
+    if (ssd->ptr_define) {
+        *ext = ssd->ptr_define->ext;
+        ssd->ptr_define = NULL;
+        ret = true;
+    } else if (ssd->ptr_move) {
+        *ext = ssd->ptr_move->ext;
+        ssd->ptr_move = NULL;
+        ret = true;
+    } else {
+        ret = false;
+    }
+    qemu_mutex_unlock(&ssd->lock);
+    return ret;
 }
 
 static int interface_req_cursor_notification(QXLInstance *sin)
@@ -617,11 +690,45 @@ static void display_refresh(DisplayChangeListener *dcl)
     qemu_spice_display_refresh(ssd);
 }
 
+static void display_mouse_set(DisplayChangeListener *dcl,
+                              int x, int y, int on)
+{
+    SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
+
+    qemu_mutex_lock(&ssd->lock);
+    ssd->ptr_x = x;
+    ssd->ptr_y = x;
+    if (ssd->ptr_move) {
+        g_free(ssd->ptr_move);
+    }
+    ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL);
+    qemu_mutex_unlock(&ssd->lock);
+}
+
+static void display_mouse_define(DisplayChangeListener *dcl,
+                                 QEMUCursor *c)
+{
+    SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
+
+    qemu_mutex_lock(&ssd->lock);
+    if (ssd->ptr_move) {
+        g_free(ssd->ptr_move);
+        ssd->ptr_move = NULL;
+    }
+    if (ssd->ptr_define) {
+        g_free(ssd->ptr_define);
+    }
+    ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c);
+    qemu_mutex_unlock(&ssd->lock);
+}
+
 static const DisplayChangeListenerOps display_listener_ops = {
-    .dpy_name        = "spice",
-    .dpy_gfx_update  = display_update,
-    .dpy_gfx_switch  = display_switch,
-    .dpy_refresh     = display_refresh,
+    .dpy_name          = "spice",
+    .dpy_gfx_update    = display_update,
+    .dpy_gfx_switch    = display_switch,
+    .dpy_refresh       = display_refresh,
+    .dpy_mouse_set     = display_mouse_set,
+    .dpy_cursor_define = display_mouse_define,
 };
 
 static void qemu_spice_display_init_one(QemuConsole *con)
commit e9d21c436f716603b3844513ba890ac570e642e1
Author: David Marchand <david.marchand at 6wind.com>
Date:   Wed Jun 11 17:25:16 2014 +0200

    char: fix avail_connections init in qemu_chr_open_eventfd()
    
    When trying to use a ivshmem server with qemu, ivshmem init code tries to
    create a CharDriverState object for each eventfd retrieved from the server.
    To create this object, a call to qemu_chr_open_eventfd() is done.
    Right after this, before adding a frontend, qemu_chr_fe_claim_no_fail() is
    called.
    qemu_chr_open_eventfd() does not set avail_connections to 1, so no frontend can
    be associated because qemu_chr_fe_claim_no_fail() makes qemu stop right away.
    
    This problem comes from 456d60692310e7ac25cf822cc1e98192ad636ece
    "qemu-char: Call fe_claim / fe_release when not using qdev chr properties".
    
    Fix this, by setting avail_connections to 1 in qemu_chr_open_eventfd().
    
    Signed-off-by: David Marchand <david.marchand at 6wind.com>
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/qemu-char.c b/qemu-char.c
index 4c04bbc..f918f90 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2493,7 +2493,13 @@ static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)
 #ifndef _WIN32
 CharDriverState *qemu_chr_open_eventfd(int eventfd)
 {
-    return qemu_chr_open_fd(eventfd, eventfd);
+    CharDriverState *chr = qemu_chr_open_fd(eventfd, eventfd);
+
+    if (chr) {
+        chr->avail_connections = 1;
+    }
+
+    return chr;
 }
 #endif
 
commit fb7da626c0d178d687f439af2e19401f34bc901e
Author: Markus Armbruster <armbru at redhat.com>
Date:   Fri Jun 6 18:35:13 2014 +0200

    audio: Drop superfluous conditionals around g_free()
    
    Signed-off-by: Markus Armbruster <armbru at redhat.com>
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index e4e5442..74ead97 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -815,10 +815,8 @@ static void alsa_fini_out (HWVoiceOut *hw)
     ldebug ("alsa_fini\n");
     alsa_anal_close (&alsa->handle, &alsa->pollhlp);
 
-    if (alsa->pcm_buf) {
-        g_free (alsa->pcm_buf);
-        alsa->pcm_buf = NULL;
-    }
+    g_free(alsa->pcm_buf);
+    alsa->pcm_buf = NULL;
 }
 
 static int alsa_init_out (HWVoiceOut *hw, struct audsettings *as)
@@ -978,10 +976,8 @@ static void alsa_fini_in (HWVoiceIn *hw)
 
     alsa_anal_close (&alsa->handle, &alsa->pollhlp);
 
-    if (alsa->pcm_buf) {
-        g_free (alsa->pcm_buf);
-        alsa->pcm_buf = NULL;
-    }
+    g_free(alsa->pcm_buf);
+    alsa->pcm_buf = NULL;
 }
 
 static int alsa_run_in (HWVoiceIn *hw)
diff --git a/audio/audio_template.h b/audio/audio_template.h
index 16f7880..8173188 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -71,10 +71,7 @@ static void glue (audio_init_nb_voices_, TYPE) (struct audio_driver *drv)
 
 static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw)
 {
-    if (HWBUF) {
-        g_free (HWBUF);
-    }
-
+    g_free (HWBUF);
     HWBUF = NULL;
 }
 
@@ -92,9 +89,7 @@ static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw)
 
 static void glue (audio_pcm_sw_free_resources_, TYPE) (SW *sw)
 {
-    if (sw->buf) {
-        g_free (sw->buf);
-    }
+    g_free (sw->buf);
 
     if (sw->rate) {
         st_rate_stop (sw->rate);
@@ -172,10 +167,8 @@ static int glue (audio_pcm_sw_init_, TYPE) (
 static void glue (audio_pcm_sw_fini_, TYPE) (SW *sw)
 {
     glue (audio_pcm_sw_free_resources_, TYPE) (sw);
-    if (sw->name) {
-        g_free (sw->name);
-        sw->name = NULL;
-    }
+    g_free (sw->name);
+    sw->name = NULL;
 }
 
 static void glue (audio_pcm_hw_add_sw_, TYPE) (HW *hw, SW *sw)
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 5a73716..4db2ca6 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -736,10 +736,8 @@ static void oss_fini_in (HWVoiceIn *hw)
 
     oss_anal_close (&oss->fd);
 
-    if (oss->pcm_buf) {
-        g_free (oss->pcm_buf);
-        oss->pcm_buf = NULL;
-    }
+    g_free(oss->pcm_buf);
+    oss->pcm_buf = NULL;
 }
 
 static int oss_run_in (HWVoiceIn *hw)
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index 5dd739e..656eb37 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -275,9 +275,7 @@ static void Adlib_fini (AdlibState *s)
     }
 #endif
 
-    if (s->mixbuf) {
-        g_free (s->mixbuf);
-    }
+    g_free(s->mixbuf);
 
     s->active = 0;
     s->enabled = 0;


More information about the Spice-commits mailing list