IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 4, 2009, 2:50:13 PM (17 years ago)
Author:
jhoblitt
Message:

yet more memory mangling fun

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/nebclient/src/nebclient.c

    r24997 r24999  
    812812    }
    813813
    814     nullstrncpy(stat->so_id, resultArray[0], 256);
    815     nullstrncpy(stat->ext_id, resultArray[1], 256);
    816     nullstrncpy(stat->read_lock, resultArray[2], 256);
     814    stat->so_id     = atol(resultArray[0]);
     815    stat->ext_id    = atol(resultArray[1]);
     816    stat->read_lock = atoi(resultArray[2]);
    817817    nullstrncpy(stat->write_lock, resultArray[3], 256);
    818818    nullstrncpy(stat->epoch, resultArray[4], 256);
     
    831831    }
    832832
    833     xfree(stat->so_id);
    834     xfree(stat->ext_id);
    835     xfree(stat->read_lock);
    836     xfree(stat->write_lock);
    837     xfree(stat->epoch);
    838     xfree(stat->mtime);
    839     xfree(stat);
     833    nebFree(stat);
    840834}
    841835
     
    935929            return -1;
    936930        }
     931
     932        int available = stat->available;
     933        nebObjectStatFree(stat);
     934
    937935        // start at one so cull() is called one less time then the # of
    938936        // instances
    939         for (long i = 1; i < stat->available; i++) {
     937        for (long i = 1; i < available; i++) {
    940938            if (!nebCull(server, key)) {
    941                 nebObjectStatFree(stat);
    942939                return -1;
    943940            }
    944941            removed++;
    945942        }
    946         nebObjectStatFree(stat);
    947943    }
    948944
     
    958954
    959955void nebFree(void *ptr) {
     956    if (!ptr) { return; }
    960957    xfree(ptr);
    961958}
     
    11971194    }
    11981195
     1196    if (!dest) {
     1197        dest = xmalloc(n + 1);
     1198    }
     1199
    11991200    return strncpy(dest, src, n);
    12001201}
Note: See TracChangeset for help on using the changeset viewer.