[brlcad-commits] CVS: brlcad/src/adrt/libtexture texture_blend.c, 1.8, 1.9 texture_bump.c, 1.9, 1.1
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: Sean M. <br...@us...> - 2007-03-20 20:05:20
|
Update of /cvsroot/brlcad/brlcad/src/adrt/libtexture In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10675/adrt/libtexture Modified Files: texture_blend.c texture_bump.c texture_camo.c texture_checker.c texture_clouds.c texture_gradient.c texture_image.c texture_mix.c texture_perlin.c texture_stack.c Log Message: since adrt uses malloc, add checks on use for a null return value. this probably would be a good reason to being associating with libbu.. (this fixes sf bug 1680679 - Check return codes everywhere; submitted by Markus Elfring (elfring)) Index: texture_blend.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_blend.c,v retrieving revision 1.8 retrieving revision 1.9 diff -w -u -r1.8 -r1.9 --- texture_blend.c 8 Feb 2007 06:49:18 -0000 1.8 +++ texture_blend.c 20 Mar 2007 20:05:07 -0000 1.9 @@ -45,6 +45,10 @@ texture_blend_t *sd; texture->data = malloc(sizeof(texture_blend_t)); + if (!texture->data) { + perror("texture->data"); + exit(1); + } texture->free = texture_blend_free; texture->work = texture_blend_work; Index: texture_bump.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_bump.c,v retrieving revision 1.9 retrieving revision 1.10 diff -w -u -r1.9 -r1.10 --- texture_bump.c 8 Feb 2007 06:49:18 -0000 1.9 +++ texture_bump.c 20 Mar 2007 20:05:07 -0000 1.10 @@ -46,6 +46,10 @@ texture_bump_t *sd; texture->data = malloc(sizeof(texture_bump_t)); + if (!texture->data) { + perror("texture->data"); + exit(1); + } texture->free = texture_bump_free; texture->work = texture_bump_work; Index: texture_camo.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_camo.c,v retrieving revision 1.9 retrieving revision 1.10 diff -w -u -r1.9 -r1.10 --- texture_camo.c 8 Feb 2007 06:49:18 -0000 1.9 +++ texture_camo.c 20 Mar 2007 20:05:07 -0000 1.10 @@ -46,6 +46,10 @@ texture_camo_t *sd; texture->data = malloc(sizeof(texture_camo_t)); + if (!texture->data) { + perror("texture->data"); + exit(1); + } texture->free = texture_camo_free; texture->work = texture_camo_work; Index: texture_checker.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_checker.c,v retrieving revision 1.9 retrieving revision 1.10 diff -w -u -r1.9 -r1.10 --- texture_checker.c 8 Feb 2007 06:49:18 -0000 1.9 +++ texture_checker.c 20 Mar 2007 20:05:07 -0000 1.10 @@ -46,6 +46,10 @@ texture_checker_t *td; texture->data = malloc(sizeof(texture_checker_t)); + if (!texture->data) { + perror("texture->data"); + exit(1); + } texture->free = texture_checker_free; texture->work = texture_checker_work; Index: texture_clouds.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_clouds.c,v retrieving revision 1.9 retrieving revision 1.10 diff -w -u -r1.9 -r1.10 --- texture_clouds.c 8 Feb 2007 06:49:18 -0000 1.9 +++ texture_clouds.c 20 Mar 2007 20:05:07 -0000 1.10 @@ -46,6 +46,10 @@ texture_clouds_t *td; texture->data = malloc(sizeof(texture_clouds_t)); + if (!texture->data) { + perror("texture->data"); + exit(1); + } texture->free = texture_clouds_free; texture->work = texture_clouds_work; Index: texture_gradient.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_gradient.c,v retrieving revision 1.8 retrieving revision 1.9 diff -w -u -r1.8 -r1.9 --- texture_gradient.c 8 Feb 2007 06:49:18 -0000 1.8 +++ texture_gradient.c 20 Mar 2007 20:05:07 -0000 1.9 @@ -46,6 +46,10 @@ texture_gradient_t *td; texture->data = malloc(sizeof(texture_gradient_t)); + if (!texture->data) { + perror("texture->data"); + exit(1); + } texture->free = texture_gradient_free; texture->work = texture_gradient_work; Index: texture_image.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_image.c,v retrieving revision 1.10 retrieving revision 1.11 diff -w -u -r1.10 -r1.11 --- texture_image.c 6 Mar 2007 21:21:16 -0000 1.10 +++ texture_image.c 20 Mar 2007 20:05:07 -0000 1.11 @@ -56,6 +56,10 @@ texture_image_t *td; texture->data = malloc(sizeof(texture_image_t)); + if (!texture->data) { + perror("texture->data"); + exit(1); + } texture->free = texture_image_free; texture->work = texture_image_work; @@ -63,6 +67,10 @@ td->w = w; td->h = h; td->image = (unsigned char *)malloc(3*w*h); + if (!td->image) { + perror("td->image"); + exit(1); + } memcpy(td->image, image, 3*w*h); } Index: texture_mix.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_mix.c,v retrieving revision 1.9 retrieving revision 1.10 diff -w -u -r1.9 -r1.10 --- texture_mix.c 8 Feb 2007 06:49:18 -0000 1.9 +++ texture_mix.c 20 Mar 2007 20:05:07 -0000 1.10 @@ -46,6 +46,10 @@ texture_mix_t *td; texture->data = malloc(sizeof(texture_mix_t)); + if (!texture->data) { + perror("texture->data"); + exit(1); + } texture->free = texture_mix_free; texture->work = texture_mix_work; Index: texture_perlin.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_perlin.c,v retrieving revision 1.10 retrieving revision 1.11 diff -w -u -r1.10 -r1.11 --- texture_perlin.c 8 Feb 2007 06:49:18 -0000 1.10 +++ texture_perlin.c 20 Mar 2007 20:05:07 -0000 1.11 @@ -58,7 +58,15 @@ int i, j, k; P->PV = (int *)malloc(sizeof(int)*(2*B+2)); + if (!P->PV) { + perror("P->PV"); + exit(1); + } P->RV = (TIE_3 *)malloc(sizeof(TIE_3)*(2*B+2)); + if (!P->RV) { + perror("P->RV"); + exit(1); + } /* Generate Random Vectors */ for (i = 0; i < B; i++) { Index: texture_stack.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/adrt/libtexture/texture_stack.c,v retrieving revision 1.8 retrieving revision 1.9 diff -w -u -r1.8 -r1.9 --- texture_stack.c 8 Feb 2007 06:49:18 -0000 1.8 +++ texture_stack.c 20 Mar 2007 20:05:07 -0000 1.9 @@ -46,6 +46,10 @@ texture_stack_t *td; texture->data = malloc(sizeof(texture_stack_t)); + if (!texture->data) { + perror("texture->data"); + exit(1); + } texture->free = texture_stack_free; texture->work = texture_stack_work; |