=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/root.c,v retrieving revision 1.25 retrieving revision 1.26 diff -c -r1.25 -r1.26 *** src/usr.bin/cvs/root.c 2005/09/11 14:16:48 1.25 --- src/usr.bin/cvs/root.c 2005/12/10 20:27:45 1.26 *************** *** 1,4 **** ! /* $OpenBSD: root.c,v 1.25 2005/09/11 14:16:48 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: root.c,v 1.26 2005/12/10 20:27:45 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 98,108 **** } } ! root = (struct cvsroot *)malloc(sizeof(*root)); ! if (root == NULL) { ! cvs_log(LP_ERRNO, "failed to allocate CVS root data"); ! return (NULL); ! } memset(root, 0, sizeof(*root)); root->cr_ref = 1; root->cr_method = CVS_METHOD_NONE; --- 98,104 ---- } } ! root = (struct cvsroot *)xmalloc(sizeof(*root)); memset(root, 0, sizeof(*root)); root->cr_ref = 1; root->cr_method = CVS_METHOD_NONE; *************** *** 112,128 **** CVS_SETVR(root, CVS_REQ_VALIDREQ); CVS_SETVR(root, CVS_REQ_VALIDRESP); ! root->cr_str = strdup(str); ! if (root->cr_str == NULL) { ! free(root); ! return (NULL); ! } ! root->cr_buf = strdup(str); ! if (root->cr_buf == NULL) { ! cvs_log(LP_ERRNO, "failed to copy CVS root"); ! cvsroot_free(root); ! return (NULL); ! } sp = root->cr_buf; cp = root->cr_buf; --- 108,115 ---- CVS_SETVR(root, CVS_REQ_VALIDREQ); CVS_SETVR(root, CVS_REQ_VALIDRESP); ! root->cr_str = xstrdup(str); ! root->cr_buf = xstrdup(str); sp = root->cr_buf; cp = root->cr_buf; *************** *** 246,257 **** cvsroot_free(struct cvsroot *root) { if (root->cr_str != NULL) ! free(root->cr_str); if (root->cr_buf != NULL) ! free(root->cr_buf); if (root->cr_version != NULL) ! free(root->cr_version); ! free(root); } /* --- 233,244 ---- cvsroot_free(struct cvsroot *root) { if (root->cr_str != NULL) ! xfree(root->cr_str); if (root->cr_buf != NULL) ! xfree(root->cr_buf); if (root->cr_version != NULL) ! xfree(root->cr_version); ! xfree(root); } /*