On Mon, Sep 04, 2017 at 11:22:48AM -0400, Frediano Ziglio wrote: > > > > Ah yeah, something might expect it was modified. Oh well, your initial > > suggestion is probably good then, though I'd explicitly check for a NULL > > msg->qxl_dirty_rects I think rather than msg->qxl_dirty_rects != > > qxl_dirty_rects. > > I cannot just check for NULL, Qemu could decide to pass a not NULL pointer, > in this can we can't free the memory used by Qemu without causing a potential > invalid free (the pointer could be from stack or allocated with another > allocator). Actually I'm not 100% sure in all cases we get a NULL but > supposing NULL would be a API breakage. The only case when you are going to allocate memory is if msg->qxl_dirty_rects is NULL. So you could do if (msg->qxl_dirty_rects == NULL) { free(qxl_dirty_rects); } rather than if (msg->qxl_dirty_rects != qxl_dirty_rects) { free(qxl_dirty_rects); } _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel