]> git.saurik.com Git - apple/ipsec.git/blobdiff - ipsec-tools/racoon/vmbuf.c
ipsec-332.100.1.tar.gz
[apple/ipsec.git] / ipsec-tools / racoon / vmbuf.c
index e0204b64ebabb8b73af1556c83aa5a72263ceffa..17929ee3af4a25ec32f0357c362aeb4b063dc5f8 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: vmbuf.c,v 1.4 2006/09/09 16:22:10 manu Exp $   */
+
 /*     $KAME: vmbuf.c,v 1.11 2001/11/26 16:54:29 sakane Exp $  */
 
 /*
@@ -44,6 +46,7 @@
 #include "misc.h"
 #include "vmbuf.h"
 #include "debug.h"
+#include "plog.h"
 #include "gcmalloc.h"
 
 vchar_t *
@@ -120,6 +123,11 @@ vdup(src)
 {
        vchar_t *new;
 
+       if (src == NULL) {
+               plog(ASL_LEVEL_ERR, "vdup(NULL) called\n");
+               return NULL;
+       }
+
        if ((new = vmalloc(src->l)) == NULL)
                return NULL;
 
@@ -127,3 +135,22 @@ vdup(src)
 
        return new;
 }
+
+vchar_t *
+vnew(in, in_len)
+       u_int8_t *in;
+       size_t    in_len;
+{
+       vchar_t *new;
+       
+       if (in == NULL) {
+               return NULL;
+       }
+       
+       if ((new = vmalloc(in_len)) == NULL)
+               return NULL;
+
+       memcpy(new->v, in, in_len);
+
+       return new;
+}