On Tue, Apr 11, 2017 at 09:58:50AM -0400, Frediano Ziglio wrote: > > > > This is intended to hold the fields that only char-device.c has a use > > for, but for now this only adds the boilerplate for it, the next commit > > will move the relevant field there. > > > > Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> > > --- > > server/char-device.c | 7 ++++++- > > server/char-device.h | 4 ++++ > > 2 files changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/server/char-device.c b/server/char-device.c > > index d325932..af5a5a8 100644 > > --- a/server/char-device.c > > +++ b/server/char-device.c > > @@ -31,6 +31,9 @@ > > #define RED_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT 30000 > > #define MAX_POOL_SIZE (10 * 64 * 1024) > > > > +struct RedCharDeviceWriteBufferPrivate { > > +}; > > + > > typedef struct RedCharDeviceClient RedCharDeviceClient; > > struct RedCharDeviceClient { > > RedCharDevice *dev; > > @@ -144,7 +147,8 @@ static void > > red_char_device_write_buffer_free(RedCharDeviceWriteBuffer *buf) > > return; > > > > free(buf->buf); > > - free(buf); > > + g_free(buf->priv); > > + g_free(buf); > > free here, not g_free, potentially they can be 2 different pools Yup, for sure, I thought g_new0 was used to create these, which is not the case. > > > } > > > > static void write_buffers_queue_free(GQueue *write_queue) > > @@ -540,6 +544,7 @@ static RedCharDeviceWriteBuffer > > *__red_char_device_write_buffer_get( > > dev->priv->cur_pool_size -= ret->buf_size; > > } else { > > ret = spice_new0(RedCharDeviceWriteBuffer, 1); > > + ret->priv = spice_new0(RedCharDeviceWriteBufferPrivate, 1); > > } > > > > spice_assert(!ret->buf_used); > > diff --git a/server/char-device.h b/server/char-device.h > > index 7854086..6d7e43e 100644 > > --- a/server/char-device.h > > +++ b/server/char-device.h > > @@ -146,6 +146,8 @@ GType red_char_device_get_type(void) G_GNUC_CONST; > > * */ > > > > /* buffer that is used for writing to the device */ > > +struct RedCharDeviceWriteBufferPrivate; > > +typedef struct RedCharDeviceWriteBufferPrivate > > RedCharDeviceWriteBufferPrivate; > > I think this last line is enough > It is enough, I've removed the other one. Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel