[Spice-devel] [PATCH spice-gtk] Use g_free() appropriately
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Thu Aug 10 10:05:07 UTC 2017
From: Marc-André Lureau <marcandre.lureau at redhat.com>
g_free() should be used in pair with g_malloc/new().
There is only free() calls remaining for usbredir rules now.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
src/decode-glz.c | 10 +++++-----
src/decode-jpeg.c | 2 +-
src/decode-zlib.c | 4 ++--
src/spice-session.c | 2 +-
src/spice-uri.c | 2 +-
tools/spicy.c | 2 +-
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/decode-glz.c b/src/decode-glz.c
index 2776539..9091ea9 100644
--- a/src/decode-glz.c
+++ b/src/decode-glz.c
@@ -71,7 +71,7 @@ static void glz_image_destroy(struct glz_image *img)
return;
pixman_image_unref(img->surface);
- free(img);
+ g_free(img);
}
/* ------------------------------------------------------------------ */
@@ -108,7 +108,7 @@ static void glz_decoder_window_resize(SpiceGlzDecoderWindow *w)
new_slot = w->images[i]->hdr.id % (w->nimages * 2);
new_images[new_slot] = w->images[i];
}
- free(w->images);
+ g_free(w->images);
w->images = new_images;
w->nimages *= 2;
}
@@ -435,8 +435,8 @@ void glz_decoder_window_destroy(SpiceGlzDecoderWindow *w)
return;
glz_decoder_window_clear(w);
- free(w->images);
- free(w);
+ g_free(w->images);
+ g_free(w);
}
SpiceGlzDecoder *glz_decoder_new(SpiceGlzDecoderWindow *w)
@@ -449,5 +449,5 @@ SpiceGlzDecoder *glz_decoder_new(SpiceGlzDecoderWindow *w)
void glz_decoder_destroy(SpiceGlzDecoder *d)
{
- free(d);
+ g_free(d);
}
diff --git a/src/decode-jpeg.c b/src/decode-jpeg.c
index 697d0de..6335153 100644
--- a/src/decode-jpeg.c
+++ b/src/decode-jpeg.c
@@ -187,5 +187,5 @@ void jpeg_decoder_destroy(SpiceJpegDecoder *decoder)
GlibJpegDecoder *d = SPICE_CONTAINEROF(decoder, GlibJpegDecoder, base);
jpeg_destroy_decompress(&d->_cinfo);
- free(d);
+ g_free(d);
}
diff --git a/src/decode-zlib.c b/src/decode-zlib.c
index a5325c0..80f384a 100644
--- a/src/decode-zlib.c
+++ b/src/decode-zlib.c
@@ -76,7 +76,7 @@ SpiceZlibDecoder *zlib_decoder_new(void)
return &d->base;
fail:
- free(d);
+ g_free(d);
return NULL;
}
@@ -85,5 +85,5 @@ void zlib_decoder_destroy(SpiceZlibDecoder *decoder)
GlibZlibDecoder *d = SPICE_CONTAINEROF(decoder, GlibZlibDecoder, base);
inflateEnd(&d->_z_strm);
- free(d);
+ g_free(d);
}
diff --git a/src/spice-session.c b/src/spice-session.c
index d236808..2aabf58 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -2276,7 +2276,7 @@ static void spice_session_channel_destroy(SpiceSession *session, SpiceChannel *c
}
ring_remove(&item->link);
- free(item);
+ g_free(item);
g_signal_emit(session, signals[SPICE_SESSION_CHANNEL_DESTROY], 0, channel);
diff --git a/src/spice-uri.c b/src/spice-uri.c
index 0376cd8..ae1347b 100644
--- a/src/spice-uri.c
+++ b/src/spice-uri.c
@@ -211,7 +211,7 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar *_uri, GError **error)
success = TRUE;
end:
- free(uri_scheme);
+ g_free(uri_scheme);
g_free(dup);
g_strfreev(uriv);
return success;
diff --git a/tools/spicy.c b/tools/spicy.c
index 5e6a620..a37eec0 100644
--- a/tools/spicy.c
+++ b/tools/spicy.c
@@ -1790,7 +1790,7 @@ static void connection_destroy(spice_connection *conn)
{
g_object_unref(conn->session);
g_hash_table_unref(conn->transfers);
- free(conn);
+ g_free(conn);
connections--;
SPICE_DEBUG("%s (%d)", __FUNCTION__, connections);
--
2.14.0.1.geff633fa0
More information about the Spice-devel
mailing list