[moodns-cvs] CVS: moodns/src byte_array.c,1.1,1.2
Status: Alpha
Brought to you by:
mawolf
From: Michael W. <ma...@us...> - 2002-01-27 09:19:48
|
Update of /cvsroot/moodns/moodns/src In directory usw-pr-cvs1:/tmp/cvs-serv30963/src Modified Files: byte_array.c Log Message: Changed malloc & friends to xmalloc & friends. Index: byte_array.c =================================================================== RCS file: /cvsroot/moodns/moodns/src/byte_array.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** byte_array.c 2002/01/09 05:48:52 1.1 --- byte_array.c 2002/01/27 09:19:46 1.2 *************** *** 81,90 **** orig->data = x; } else { ! free(y); return 0; } memcpy(orig->data + orig->len, y, len); orig->len += len; ! free(y); return orig->len; } --- 81,90 ---- orig->data = x; } else { ! xfree(y); return 0; } memcpy(orig->data + orig->len, y, len); orig->len += len; ! xfree(y); return orig->len; } *************** *** 117,121 **** orig->data = x; } else { ! free(y); return 0; } --- 117,121 ---- orig->data = x; } else { ! xfree(y); return 0; } *************** *** 123,127 **** memcpy(orig->data + idx, y, len); orig->len += len; ! free(y); return orig->len; } --- 123,127 ---- memcpy(orig->data + idx, y, len); orig->len += len; ! xfree(y); return orig->len; } *************** *** 171,179 **** if (idx + len > orig->len) { ! free(y); return 0; } memcpy(orig->data + idx, y, len); ! free(y); return orig->len; } --- 171,179 ---- if (idx + len > orig->len) { ! xfree(y); return 0; } memcpy(orig->data + idx, y, len); ! xfree(y); return orig->len; } *************** *** 184,192 **** printf("orig = %p, orig->data = %p\n", orig, orig->data); if (orig != NULL && orig->data != NULL) { ! free(orig->data); orig->data = NULL; } if (orig != NULL) { ! free(orig); orig = NULL; } --- 184,192 ---- printf("orig = %p, orig->data = %p\n", orig, orig->data); if (orig != NULL && orig->data != NULL) { ! xfree(orig->data); orig->data = NULL; } if (orig != NULL) { ! xfree(orig); orig = NULL; } *************** *** 196,202 **** int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) { ! byte_array *t = (byte_array *) calloc(1, sizeof(byte_array)); ! byte_array *ins = (byte_array *) calloc(1, sizeof(byte_array)); ! byte_array *rep = (byte_array *) calloc(1, sizeof(byte_array)); char buf[1024]; --- 196,202 ---- int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) { ! byte_array *t = (byte_array *) xcalloc(1, sizeof(byte_array)); ! byte_array *ins = (byte_array *) xcalloc(1, sizeof(byte_array)); ! byte_array *rep = (byte_array *) xcalloc(1, sizeof(byte_array)); char buf[1024]; |