s390: Fix buggy assignment
PATCH 1/1 s390: Fix buggy assignment
nd->model keeps dynamically allocated model names. So casting of a constant string is wrong here.
Signed-off-by Stefan Weil <[email protected]>
--- hw/s390-virtio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/s390-virtio.c +1 -1
@@ -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" )) {
Signature · 1 line
1.6.5
Quoted 4 lines · Stefan Weil
nd->modelkeeps dynamically allocated model names. So casting of a constant string is wrong here.Signed-off-by Stefan Weil <[email protected]>
So we're wasting 7 bytes of strdup malloc'ed data we never free. Probably now worth thinking about though.
Acked-by Alexander Graf <[email protected]>