X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=render%2Frender.c;h=13257910d08368d16bd03a1f381935d59a2f0852;hb=e442c6cc56813ac2d80ddf956603b6d0123d8145;hp=51c3a9beb4a8134b7e0466dae6692da10e552c5a;hpb=0c2f95674f56e25e2b74cce506d9d89ec41252a4;p=chaz%2Fopenbox diff --git a/render/render.c b/render/render.c index 51c3a9be..13257910 100644 --- a/render/render.c +++ b/render/render.c @@ -141,6 +141,7 @@ Appearance *appearance_new(SurfaceType type, int numtex) out->textures = numtex; out->xftdraw = NULL; if (numtex) out->texture = g_new(Texture, numtex); + else out->texture = NULL; out->pixmap = None; switch (type) { @@ -191,10 +192,7 @@ Appearance *appearance_copy(Appearance *orig) break; } copy->textures = orig->textures; - if (orig->textures) { - copy->texture = malloc(orig->textures * sizeof(Texture)); - memcpy(copy->texture, orig->texture, orig->textures * sizeof(Texture)); - } else copy->texture = NULL; + copy->texture = g_memdup(orig->texture, orig->textures * sizeof(Texture)); copy->pixmap = None; copy->xftdraw = NULL; return copy; @@ -212,6 +210,7 @@ void appearance_free(Appearance *a) if (p->primary != NULL) color_free(p->primary); if (p->secondary != NULL) color_free(p->secondary); if (p->border_color != NULL) color_free(p->border_color); + if (p->pixel_data != NULL) g_free(p->pixel_data); } g_free(a); }