summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann2014-04-25 12:06:47 +0200
committerGerd Hoffmann2014-05-05 12:57:49 +0200
commit457d397a2485225a96d6a9fc33cfe04f99e1e0f4 (patch)
tree14293f7c9b71734d020774c3c5206513259d1ff5
parentusb: mtp: fix error path memory leak (diff)
downloadqemu-457d397a2485225a96d6a9fc33cfe04f99e1e0f4.tar.gz
qemu-457d397a2485225a96d6a9fc33cfe04f99e1e0f4.tar.xz
qemu-457d397a2485225a96d6a9fc33cfe04f99e1e0f4.zip
usb: mtp: avoid empty description string
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--hw/usb/dev-mtp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 45f9562c60..a30a88639c 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -1046,7 +1046,7 @@ static int usb_mtp_initfn(USBDevice *dev)
QTAILQ_INIT(&s->objects);
if (s->desc == NULL) {
s->desc = strrchr(s->root, '/');
- if (s->desc) {
+ if (s->desc && s->desc[0]) {
s->desc = g_strdup(s->desc + 1);
} else {
s->desc = g_strdup("none");