diff options
-rw-r--r-- | net/tap-win32.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/tap-win32.c b/net/tap-win32.c index fb92b55768..897bd18e32 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -686,7 +686,7 @@ static ssize_t tap_receive(NetClientState *nc, const uint8_t *buf, size_t size) static void tap_win32_send(void *opaque) { TAPState *s = opaque; - uint8_t *buf; + uint8_t *buf, *orig_buf; int max_size = 4096; int size; uint8_t min_pkt[ETH_ZLEN]; @@ -694,6 +694,8 @@ static void tap_win32_send(void *opaque) size = tap_win32_read(s->handle, &buf, max_size); if (size > 0) { + orig_buf = buf; + if (!s->nc.peer->do_not_pad) { if (eth_pad_short_frame(min_pkt, &min_pktsz, buf, size)) { buf = min_pkt; @@ -702,7 +704,7 @@ static void tap_win32_send(void *opaque) } qemu_send_packet(&s->nc, buf, size); - tap_win32_free_buffer(s->handle, buf); + tap_win32_free_buffer(s->handle, orig_buf); } } |