From: Dana Jansens Date: Wed, 19 Mar 2003 07:58:39 +0000 (+0000) Subject: initialize texture to NULL if theres no textures. use g_memdup to copy it X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=7bd747389d3463b00919fd21dfb21d31feb2c3f8;p=chaz%2Fopenbox initialize texture to NULL if theres no textures. use g_memdup to copy it --- diff --git a/render/render.c b/render/render.c index 51c3a9be..b048bcec 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,8 @@ 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;