ioemu: Fix vnc buffer sharing when linesize != width * depth.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This commit is contained in:
Keir Fraser committed 2008-03-20 18:28:52 +00:00
1 parent b44e418cc1
commit 930e7c4bb2
1 file changed
+10 -7
+10 -7
View File
@@ -370,16 +370,20 @@ static void vnc_dpy_resize(DisplayState *ds, int w, int h, int linesize)
int o;
if (!ds->shared_buf) {
ds->linesize = w * vs->depth;
if (allocated)
ds->data = realloc(ds->data, h * linesize);
ds->data = realloc(ds->data, h * ds->linesize);
else
ds->data = malloc(h * linesize);
ds->data = malloc(h * ds->linesize);
allocated = 1;
} else if (allocated) {
free(ds->data);
allocated = 0;
} else {
ds->linesize = linesize;
if (allocated) {
free(ds->data);
allocated = 0;
}
}
vs->old_data = realloc(vs->old_data, h * linesize);
vs->old_data = realloc(vs->old_data, h * ds->linesize);
vs->dirty_row = realloc(vs->dirty_row, h * sizeof(vs->dirty_row[0]));
vs->update_row = realloc(vs->update_row, h * sizeof(vs->dirty_row[0]));
@@ -396,7 +400,6 @@ static void vnc_dpy_resize(DisplayState *ds, int w, int h, int linesize)
size_changed = ds->width != w || ds->height != h;
ds->width = w;
ds->height = h;
ds->linesize = linesize;
if (vs->csock != -1 && vs->has_resize && size_changed) {
vs->width = ds->width;
vs->height = ds->height;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.