Revision: 54118
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54118&view=rev
Author:   caen23
Date:     2012-12-26 19:17:26 +0000 (Wed, 26 Dec 2012)
Log Message:
-----------
Fix Clang static analysis defects (GCI: 
http://www.google-melange.com/gci/task/view/google/gci2012/7987232)

Modified Paths:
--------------
    brlcad/trunk/src/libbn/anim.c
    brlcad/trunk/src/libbn/plane.c
    brlcad/trunk/src/libbn/poly.c
    brlcad/trunk/src/libbn/tcl.c
    brlcad/trunk/src/libbn/tri_tri.c
    brlcad/trunk/src/libbu/color.c
    brlcad/trunk/src/libbu/fnmatch.c
    brlcad/trunk/src/libbu/hash.c
    brlcad/trunk/src/libbu/mappedfile.c
    brlcad/trunk/src/util/asc-pl.c
    brlcad/trunk/src/util/bary.c
    brlcad/trunk/src/util/bwmod.c
    brlcad/trunk/src/util/bwscale.c
    brlcad/trunk/src/util/bwshrink.c
    brlcad/trunk/src/util/imgdims.c
    brlcad/trunk/src/util/pix-alias.c
    brlcad/trunk/src/util/pix-orle.c
    brlcad/trunk/src/util/pixbackgnd.c
    brlcad/trunk/src/util/pixclump.c
    brlcad/trunk/src/util/pixcount.c
    brlcad/trunk/src/util/pixcut.c
    brlcad/trunk/src/util/pixdsplit.c
    brlcad/trunk/src/util/pixfields.c
    brlcad/trunk/src/util/pixinterp2x.c
    brlcad/trunk/src/util/pixmorph.c
    brlcad/trunk/src/util/pixscale.c
    brlcad/trunk/src/util/pixshrink.c
    brlcad/trunk/src/util/pixtile.c
    brlcad/trunk/src/util/plrot.c
    brlcad/trunk/src/util/sun-pix.c
    brlcad/trunk/src/util/ttcp.c

Modified: brlcad/trunk/src/libbn/anim.c
===================================================================
--- brlcad/trunk/src/libbn/anim.c       2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/libbn/anim.c       2012-12-26 19:17:26 UTC (rev 54118)
@@ -628,7 +628,6 @@
     vect_t dx;
 
     VMOVE(dx, dx2);
-    sign = 1.0;
     mag = MAGNITUDE(dx);
     if (mag < VDIVIDE_TOL) {
        bu_log("anim_dirn2mat: Need non-zero vector");
@@ -647,7 +646,6 @@
        if (mag < VDIVIDE_TOL) {
            /* use default */
            VSET(temp, 0.0, 1.0, 0.0);
-           mag = 1.0;
        } else {
            inv = 1.0/mag;
            temp[0] *= inv;

Modified: brlcad/trunk/src/libbn/plane.c
===================================================================
--- brlcad/trunk/src/libbn/plane.c      2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/libbn/plane.c      2012-12-26 19:17:26 UTC (rev 54118)
@@ -118,7 +118,6 @@
     }
 
     if (mag_ca > max_len) {
-       max_len = mag_ca;
        max_edge_no = 3;
     }
 
@@ -846,12 +845,10 @@
        if (bn_pt2_pt2_equal(a, hit_pt, tol) ||
            bn_pt2_pt2_equal(a, hit2, tol)) {
            dist[1] = 0;
-           ret = 1;    /* Intersect is at A */
        }
        if (bn_pt2_pt2_equal(b, hit_pt, tol) ||
            bn_pt2_pt2_equal(b, hit_pt, tol)) {
            dist[1] = 1;
-           ret = 2;    /* Intersect is at B */
        }
 
        ret = bn_isect_pt2_lseg2(&ab_dist, a, b, hit_pt, tol);
@@ -1221,12 +1218,8 @@
        bu_bomb("bn_isect_line3_line3(): logic error, lines colinear but not 
parallel\n");
     }
 
-    if (parallel && !colinear) {
-       /* lines are parallel */
-       sc = d / pdir_mag_sq;
-       tc = 0.0;
+    if (parallel && !colinear)
        return -2; /* no intersection, lines are parallel */
-    }
 
     if (parallel && colinear) {
 

Modified: brlcad/trunk/src/libbn/poly.c
===================================================================
--- brlcad/trunk/src/libbn/poly.c       2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/libbn/poly.c       2012-12-26 19:17:26 UTC (rev 54118)
@@ -335,7 +335,6 @@
 
        if (a >= 0.0) {
            fact = 0.0;
-           phi = 0.0;
            cs_phi = 1.0;               /* cos(phi); */
            sn_phi_s3 = 0.0;    /* sin(phi) * SQRT3; */
        } else {
@@ -343,7 +342,6 @@
            a *= -THIRD;
            fact = sqrt(a);
            if ((f = b * (-0.5) / (a*fact)) >= 1.0) {
-               phi = 0.0;
                cs_phi = 1.0;           /* cos(phi); */
                sn_phi_s3 = 0.0;        /* sin(phi) * SQRT3; */
            }  else if (f <= -1.0) {

Modified: brlcad/trunk/src/libbn/tcl.c
===================================================================
--- brlcad/trunk/src/libbn/tcl.c        2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/libbn/tcl.c        2012-12-26 19:17:26 UTC (rev 54118)
@@ -871,7 +871,7 @@
                for (xval = 0; xval < xdim; xval++) {
                    pt[X] = xval * scale[X] + delta[X];
 
-                   val = bn_noise_fbm(pt, h_val, lacunarity, octaves);
+                   bn_noise_fbm(pt, h_val, lacunarity, octaves);
 
                }
            }

Modified: brlcad/trunk/src/libbn/tri_tri.c
===================================================================
--- brlcad/trunk/src/libbn/tri_tri.c    2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/libbn/tri_tri.c    2012-12-26 19:17:26 UTC (rev 54118)
@@ -390,7 +390,7 @@
     bb=(float)FABS(D[1]);
     cc=(float)FABS(D[2]);
     if (bb>max) max=bb, index=1;
-    if (cc>max) max=cc, index=2;
+    if (cc>max) index=2;
 
     /* this is the simplified projection onto L*/
     vp0=V0[index];
@@ -551,7 +551,7 @@
     b=fabs(D[1]);
     c=fabs(D[2]);
     if (b>max) max=b, index=1;
-    if (c>max) max=c, index=2;
+    if (c>max) index=2;
 
     /* this is the simplified projection onto L*/
     vp0=V0[index];

Modified: brlcad/trunk/src/libbu/color.c
===================================================================
--- brlcad/trunk/src/libbu/color.c      2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/libbu/color.c      2012-12-26 19:17:26 UTC (rev 54118)
@@ -186,11 +186,11 @@
     if (*str == '#') {
        if (strlen(++str) != 6)
            return 0;
-       num = sscanf(str, "%02x%02x%02x", (unsigned int *)&r, (unsigned int 
*)&g, (unsigned int *)&b);
+       sscanf(str, "%02x%02x%02x", (unsigned int *)&r, (unsigned int *)&g, 
(unsigned int *)&b);
     } else if (isdigit((int)(*str))) {
        num = sscanf(str, "%d/%d/%d", &r, &g, &b);
        if (num == 1) {
-           num = sscanf(str, "%d %d %d", &r, &g, &b);
+           sscanf(str, "%d %d %d", &r, &g, &b);
        }
        VSET(rgb, r, g, b);
        if ((r < 0) || (r > 255)

Modified: brlcad/trunk/src/libbu/fnmatch.c
===================================================================
--- brlcad/trunk/src/libbu/fnmatch.c    2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/libbu/fnmatch.c    2012-12-26 19:17:26 UTC (rev 54118)
@@ -217,7 +217,6 @@
        c = *pattern++; /* next */
     }
     c = *pattern++;
-    if (c != ']') resultholder = -1;
     bu_vls_strncpy(&classname, pattern-counter-2, counter);
 
     ctclass = findclass(bu_vls_addr(&classname));

Modified: brlcad/trunk/src/libbu/hash.c
===================================================================
--- brlcad/trunk/src/libbu/hash.c       2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/libbu/hash.c       2012-12-26 19:17:26 UTC (rev 54118)
@@ -34,7 +34,6 @@
     unsigned long hash = 5381;
     int i, c;
 
-    c = *str;
     for (i=0; i<len; i++) {
        c = *str;
        hash = ((hash << 5) + hash) + c; /* hash * 33 + c */

Modified: brlcad/trunk/src/libbu/mappedfile.c
===================================================================
--- brlcad/trunk/src/libbu/mappedfile.c 2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/libbu/mappedfile.c 2012-12-26 19:17:26 UTC (rev 54118)
@@ -269,7 +269,6 @@
        bu_semaphore_acquire(BU_SEM_SYSCALL);
        (void)close(fd);
        bu_semaphore_release(BU_SEM_SYSCALL);
-       fd = -1;
     }
 
     mp->uses = 1;
@@ -292,7 +291,6 @@
        bu_semaphore_acquire(BU_SEM_SYSCALL);
        (void)close(fd);
        bu_semaphore_release(BU_SEM_SYSCALL);
-       fd = -1;
     }
 
     if (mp) {

Modified: brlcad/trunk/src/util/asc-pl.c
===================================================================
--- brlcad/trunk/src/util/asc-pl.c      2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/asc-pl.c      2012-12-26 19:17:26 UTC (rev 54118)
@@ -62,10 +62,10 @@
     char buf[BUF_LEN];
     char sarg[BUF_LEN];
     static char *fm[] = { "r", "w" };
-    double darg[6];
+    double darg[6] = {0.0};
     static FILE *fp[2];
     int i;
-    int iarg[6];
+    int iarg[6] = {0};
     int line_nm;
     int nm_args = 0;
 

Modified: brlcad/trunk/src/util/bary.c
===================================================================
--- brlcad/trunk/src/util/bary.c        2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/bary.c        2012-12-26 19:17:26 UTC (rev 54118)
@@ -174,7 +174,6 @@
 
     switch (argc - bu_optind) {
        case 0:
-           inf_name = "stdin";
            infp = stdin;
            break;
        case 1:

Modified: brlcad/trunk/src/util/bwmod.c
===================================================================
--- brlcad/trunk/src/util/bwmod.c       2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/bwmod.c       2012-12-26 19:17:26 UTC (rev 54118)
@@ -183,7 +183,7 @@
                case OR  : tmp=d; tmp |= (int)val[i]; d=tmp;break;
                case AND : tmp=d; tmp &= (int)val[i]; d=tmp;break;
                case XOR : tmp=d; tmp ^= (int)val[i]; d= tmp; break;
-               case TRUNC: tmp=((int)d/(int)val[i])*(int)val[i]; break;
+               /* case TRUNC: tmp=((int)d/(int)val[i])*(int)val[i]; break; */
                default  : fprintf(stderr, "%s: error in op\n", progname);
                    bu_exit (-1, NULL);
                    break;

Modified: brlcad/trunk/src/util/bwscale.c
===================================================================
--- brlcad/trunk/src/util/bwscale.c     2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/bwscale.c     2012-12-26 19:17:26 UTC (rev 54118)
@@ -412,7 +412,7 @@
     outbuf = (unsigned char *)bu_malloc(i, "outbuf");
 
     /* Here we go */
-    i = scale(stdout, inx, iny, outx, outy);
+    scale(stdout, inx, iny, outx, outy);
 
     bu_free(outbuf, (const char *)buffer);
     bu_free(buffer, (const char *)buffer);

Modified: brlcad/trunk/src/util/bwshrink.c
===================================================================
--- brlcad/trunk/src/util/bwshrink.c    2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/bwshrink.c    2012-12-26 19:17:26 UTC (rev 54118)
@@ -86,9 +86,8 @@
     p = buffer;
 
     for (y=0; y < h; y += Factor)
-       for (x=0; x < w; x += Factor, p++) {
+       for (x=0; x < w; x += Factor, p++)
            p[0] = buffer[x + y * w];
-       }
 }
 
 
@@ -188,6 +187,7 @@
     if ((buffer = (unsigned char *)malloc(width*height)) == (unsigned char 
*)NULL) {
        fprintf(stderr, "%s: cannot allocate input buffer\n",
                      progname);
+        bu_free(buffer, "buffer alloc from malloc");
        bu_exit (-1, NULL);
     }
 
@@ -196,6 +196,8 @@
        /* do nothing */;
     }
 
+    bu_free(buffer, "buffer alloc from malloc");
+
     if (c < 0) {
        perror (filename);
        return -1;
@@ -211,6 +213,8 @@
     for (t=0; t < size && (c=write(1, (char *)&buffer[t], size-t)) >= 0;
         t += c);
 
+    bu_free(buffer, "buffer alloc from malloc");
+
     if (c < 0) {
        perror("stdout");
        return -1;

Modified: brlcad/trunk/src/util/imgdims.c
===================================================================
--- brlcad/trunk/src/util/imgdims.c     2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/imgdims.c     2012-12-26 19:17:26 UTC (rev 54118)
@@ -132,9 +132,10 @@
     }
 
     argument = bu_realpath(argv[bu_optind], NULL);
-    if (!bu_file_exists(argument, NULL))
+    if (!bu_file_exists(argument, NULL)) {
        bu_free(argument, "argument realpath");
        bu_exit(1, "image file [%s] does not exist\n", argument);
+    }
 
     if ((stat(argument, &stat_buf) != 0)
        && (!grab_number(argument, &nm_bytes)))

Modified: brlcad/trunk/src/util/pix-alias.c
===================================================================
--- brlcad/trunk/src/util/pix-alias.c   2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pix-alias.c   2012-12-26 19:17:26 UTC (rev 54118)
@@ -81,7 +81,7 @@
     for (n=y-1; n >= 0; --n)
        if (fread(&image[n*x*3], x*3, 1, stdin) != 1) {
            (void) fprintf(stderr, "Error reading image at scanline %u\n", n);
-           free(image);
+           bu_free(image, "image alloc from malloc");
            bu_exit (-2, NULL);
        }
 
@@ -122,7 +122,7 @@
        (void) putchar(image[cpix+1]);
        (void) putchar(image[cpix]);
     }
-    free(image);
+    bu_free(image, "image alloc from malloc");
 }
 
 

Modified: brlcad/trunk/src/util/pix-orle.c
===================================================================
--- brlcad/trunk/src/util/pix-orle.c    2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pix-orle.c    2012-12-26 19:17:26 UTC (rev 54118)
@@ -153,8 +153,10 @@
     rle_wpos(0, 0, 1);         /* Start position is origin */
 
     /* Write RLE header, ncolors=3, bgflag=0 */
-    if (rle_whdr(outfp, 3, 0, 0, RGBPIXEL_NULL) == -1)
+    if (rle_whdr(outfp, 3, 0, 0, RGBPIXEL_NULL) == -1) {
+        bu_free(scan_buf, "scan_buf alloc form malloc");
        return 1;
+    }
 
     /* Read image a scanline at a time, and encode it */
     for (y = 0; y < file_height; y++) {
@@ -163,13 +165,18 @@
        ret = fread((char *)scan_buf, sizeof(RGBpixel), file_width, infp);
        if (ret != file_width) {
            (void) fprintf(stderr, "read of %lu pixels on line %lu failed!\n", 
(unsigned long)file_width, (unsigned long)y);
+            bu_free(scan_buf, "scan_buf alloc form malloc");
            return 1;
        }
 
-       if (rle_encode_ln(outfp, scan_buf) == -1)
+       if (rle_encode_ln(outfp, scan_buf) == -1) {
+            bu_free(scan_buf, "scan_buf alloc form malloc");
            return 1;
+        }
     }
 
+    bu_free(scan_buf, "scan_buf alloc form malloc");
+
     fclose(infp);
     fclose(outfp);
     return 0;

Modified: brlcad/trunk/src/util/pixbackgnd.c
===================================================================
--- brlcad/trunk/src/util/pixbackgnd.c  2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixbackgnd.c  2012-12-26 19:17:26 UTC (rev 54118)
@@ -323,6 +323,9 @@
            flood(horiz_buf, vert_buf, vp, line);
     }
 
+    bu_free(horiz_buf, "horiz_buf alloc from malloc");
+    bu_free(vp, "vp");
+
     return 0;
 }
 

Modified: brlcad/trunk/src/util/pixclump.c
===================================================================
--- brlcad/trunk/src/util/pixclump.c    2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixclump.c    2012-12-26 19:17:26 UTC (rev 54118)
@@ -209,7 +209,6 @@
        }
     switch (argc - bu_optind) {
        case 0:
-           inf_name = "stdin";
            infp = stdin;
            /* Break intentionally missing */
        case 1:

Modified: brlcad/trunk/src/util/pixcount.c
===================================================================
--- brlcad/trunk/src/util/pixcount.c    2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixcount.c    2012-12-26 19:17:26 UTC (rev 54118)
@@ -198,11 +198,9 @@
        }
     switch (argc - bu_optind) {
        case 0:
-           inf_name = "stdin";
            infp = stdin;
            /* Break intentionally missing */
        case 1:
-           outf_name = "stdout";
            outfp = stdout;
            /* Break intentionally missing */
        case 2:

Modified: brlcad/trunk/src/util/pixcut.c
===================================================================
--- brlcad/trunk/src/util/pixcut.c      2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixcut.c      2012-12-26 19:17:26 UTC (rev 54118)
@@ -317,7 +317,7 @@
     }
 
     while (row < base_y) {
-       result = fread(inbuf, num_bytes, org_width, input);
+       fread(inbuf, num_bytes, org_width, input);
        row++;
     }
 /*

Modified: brlcad/trunk/src/util/pixdsplit.c
===================================================================
--- brlcad/trunk/src/util/pixdsplit.c   2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixdsplit.c   2012-12-26 19:17:26 UTC (rev 54118)
@@ -118,7 +118,6 @@
      */
     switch (argc - bu_optind) {
        case 0:
-           inf_name = "stdin";
            infd = 0;
            break;
        case 1:

Modified: brlcad/trunk/src/util/pixfields.c
===================================================================
--- brlcad/trunk/src/util/pixfields.c   2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixfields.c   2012-12-26 19:17:26 UTC (rev 54118)
@@ -145,6 +145,8 @@
        line_number++;
     }
 
+    bu_free(line2, "line2 alloc from malloc");
+
     return 0;
 }
 

Modified: brlcad/trunk/src/util/pixinterp2x.c
===================================================================
--- brlcad/trunk/src/util/pixinterp2x.c 2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixinterp2x.c 2012-12-26 19:17:26 UTC (rev 54118)
@@ -136,6 +136,7 @@
            interp_lines(outy-1, outy, outy-2);
     }
     ret = write(1, (char *)outbuf, outsize);
+    bu_free(inbuf, "inbuf alloc from malloc");
     if (ret != outsize) {
        perror("pixinterp2x write");
        bu_exit (1, NULL);

Modified: brlcad/trunk/src/util/pixmorph.c
===================================================================
--- brlcad/trunk/src/util/pixmorph.c    2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixmorph.c    2012-12-26 19:17:26 UTC (rev 54118)
@@ -482,6 +482,11 @@
     if (pa == NULL || pb == NULL || wa == NULL ||  wb == NULL ||
        morph == NULL) {
        fprintf(stderr, "pixmorph: memory allocation failure\n");
+        bu_free(pa, "pa alloc from malloc");
+        bu_free(pb, "pb alloc from malloc");
+        bu_free(wa, "wa alloc from malloc");
+        bu_free(wb, "wb alloc from malloc");
+        bu_free(morph, "morph alloc from malloc");
        return 1;
     }
 

Modified: brlcad/trunk/src/util/pixscale.c
===================================================================
--- brlcad/trunk/src/util/pixscale.c    2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixscale.c    2012-12-26 19:17:26 UTC (rev 54118)
@@ -430,7 +430,7 @@
     outbuf = bu_malloc(i, "outbuf");
 
     /* Here we go */
-    i = scale(stdout, inx, iny, outx, outy);
+    scale(stdout, inx, iny, outx, outy);
     bu_free(outbuf, "outbuf");
     bu_free(buffer, "buffer");
     return 0;

Modified: brlcad/trunk/src/util/pixshrink.c
===================================================================
--- brlcad/trunk/src/util/pixshrink.c   2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixshrink.c   2012-12-26 19:17:26 UTC (rev 54118)
@@ -153,6 +153,8 @@
            p[1] = buffer[t+1];
            p[2] = buffer[t+2];
        }
+
+    bu_free(p, "p");
 }
 
 
@@ -250,9 +252,8 @@
 
     switch (method) {
        case METH_BOXCAR : shrink_image(scanlen, width, height, buffer, 
factor); break;
-       case METH_UNDERSAMPLE : usample_image(scanlen, width, height, buffer, 
factor);
-           break;
-       default: return -1;
+       case METH_UNDERSAMPLE : usample_image(scanlen, width, height, buffer, 
factor); break;
+       default: bu_free(buffer, "buffer alloc from malloc"); return -1;
     }
 
     write_image(width/factor, height/factor, buffer);

Modified: brlcad/trunk/src/util/pixtile.c
===================================================================
--- brlcad/trunk/src/util/pixtile.c     2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/pixtile.c     2012-12-26 19:17:26 UTC (rev 54118)
@@ -223,6 +223,8 @@
            perror("write");
     }
 
+    bu_free(obuf, "obuf alloc from malloc");
+
     fprintf(stderr, "\n");
 
     return 0;

Modified: brlcad/trunk/src/util/plrot.c
===================================================================
--- brlcad/trunk/src/util/plrot.c       2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/plrot.c       2012-12-26 19:17:26 UTC (rev 54118)
@@ -278,9 +278,9 @@
                verbose++;
                break;
            case 'S':
-               num = sscanf(bu_optarg, "%lf %lf %lf %lf %lf %lf",
-                            &mtmp[0], &mtmp[1], &mtmp[2],
-                            &mtmp[3], &mtmp[4], &mtmp[5]);
+               sscanf(bu_optarg, "%lf %lf %lf %lf %lf %lf",
+                       &mtmp[0], &mtmp[1], &mtmp[2],
+                      &mtmp[3], &mtmp[4], &mtmp[5]);
                VSET(forced_space_min, mtmp[0], mtmp[1], mtmp[2]);
                VSET(forced_space_max, mtmp[3], mtmp[4], mtmp[5]);
 

Modified: brlcad/trunk/src/util/sun-pix.c
===================================================================
--- brlcad/trunk/src/util/sun-pix.c     2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/sun-pix.c     2012-12-26 19:17:26 UTC (rev 54118)
@@ -364,7 +364,6 @@
     }
 
     width = header.ras_width;
-    x = 0;
 
     switch (header.ras_depth) {
        case 1:
@@ -440,7 +439,7 @@
            while ((header.ras_type == RT_BYTE_ENCODED) ?
                   decoderead(buf, sizeof(*buf), scanbytes, fp) :
                   fread(buf, sizeof(*buf), scanbytes, fp)) {
-               for (x=0; x < width; x++) {
+               for (x = 0; x < width && x < (int)sizeof(*buf); x++) {
                    cmap_idx = buf[x];
                    if (cmap_idx >= CMAP_MAX_INDEX) {
                        bu_log("Warning: Read invalid index %u.\n",

Modified: brlcad/trunk/src/util/ttcp.c
===================================================================
--- brlcad/trunk/src/util/ttcp.c        2012-12-26 17:07:57 UTC (rev 54117)
+++ brlcad/trunk/src/util/ttcp.c        2012-12-26 19:17:26 UTC (rev 54118)
@@ -67,7 +67,6 @@
 #  include <sys/resource.h>
 #endif
 
-
 struct sockaddr_in sinme;
 struct sockaddr_in sinhim;
 struct sockaddr_in sindum;
@@ -658,6 +657,7 @@
        (void)Nwrite(fd, buf, 4); /* rcvr end */
        (void)Nwrite(fd, buf, 4); /* rcvr end */
     }
+    free(buf);
     fprintf(stderr, "ttcp%s: %s\n", trans?"-t":"-r", stats);
     if (cput <= 0.0) cput = 0.001;
     if (realt <= 0.0) realt = 0.001;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to