* [Qemu-devel] [PATCH] s390: Fix buggy assignment
@ 2009-12-14 9:39 Stefan Weil
2009-12-14 10:06 ` [Qemu-devel] " Alexander Graf
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2009-12-14 9:39 UTC (permalink / raw)
To: QEMU Developers, Alexander Graf, Aurelien Jarno
nd->model keeps dynamically allocated model names.
So casting of a constant string is wrong here.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
hw/s390-virtio.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index b567886..b57fa9c 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -209,7 +209,7 @@ static void s390_init(ram_addr_t ram_size,
DeviceState *dev;
if (!nd->model) {
- nd->model = (char*)"virtio";
+ nd->model = qemu_strdup("virtio");
}
if (strcmp(nd->model, "virtio")) {
--
1.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] Re: [PATCH] s390: Fix buggy assignment
2009-12-14 9:39 [Qemu-devel] [PATCH] s390: Fix buggy assignment Stefan Weil
@ 2009-12-14 10:06 ` Alexander Graf
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Graf @ 2009-12-14 10:06 UTC (permalink / raw)
To: Stefan Weil; +Cc: QEMU Developers, Aurelien Jarno
On 14.12.2009, at 10:39, Stefan Weil wrote:
> nd->model keeps dynamically allocated model names.
> So casting of a constant string is wrong here.
>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
So we're wasting 7 bytes of strdup malloc'ed data we never free. Probably now worth thinking about though.
Acked-by: Alexander Graf <agraf@suse.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-14 10:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-14 9:39 [Qemu-devel] [PATCH] s390: Fix buggy assignment Stefan Weil
2009-12-14 10:06 ` [Qemu-devel] " Alexander Graf
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).