]> git.saurik.com Git - apple/libinfo.git/blobdiff - rpc.subproj/svc_udp.c
Libinfo-517.30.1.tar.gz
[apple/libinfo.git] / rpc.subproj / svc_udp.c
index b74daf58fbbdfeeff744da18d272aba6104d4566..ac83afc41fbf2daed63ffc0b74708defd52110bb 100644 (file)
@@ -162,11 +162,14 @@ svcudp_bufcreate(sock, sendsz, recvsz)
        }
        su = (struct svcudp_data *)mem_alloc(sizeof(*su));
        if (su == NULL) {
+               mem_free(xprt, sizeof(SVCXPRT));
                (void)fprintf(stderr, "svcudp_create: out of memory\n");
                return (NULL);
        }
        su->su_iosz = ((MAX(sendsz, recvsz) + 3) / 4) * 4;
        if ((rpc_buffer(xprt) = mem_alloc(su->su_iosz)) == NULL) {
+               mem_free(xprt, sizeof(SVCXPRT));
+               mem_free(su, sizeof(*su));
                (void)fprintf(stderr, "svcudp_create: out of memory\n");
                return (NULL);
        }
@@ -281,7 +284,7 @@ svcudp_getargs(xprt, xdr_args, args_ptr)
        caddr_t args_ptr;
 {
 
-       return ((*xdr_args)(&(su_data(xprt)->su_xdrs), args_ptr));
+       return ((*xdr_args)(&(su_data(xprt)->su_xdrs), args_ptr, 0));
 }
 
 static bool_t
@@ -293,7 +296,7 @@ svcudp_freeargs(xprt, xdr_args, args_ptr)
        register XDR *xdrs = &(su_data(xprt)->su_xdrs);
 
        xdrs->x_op = XDR_FREE;
-       return ((*xdr_args)(xdrs, args_ptr));
+       return ((*xdr_args)(xdrs, args_ptr, 0));
 }
 
 static void
@@ -429,12 +432,15 @@ svcudp_enablecache(transp, size)
        uc->uc_nextvictim = 0;
        uc->uc_entries = ALLOC(cache_ptr, size * SPARSENESS);
        if (uc->uc_entries == NULL) {
+               mem_free(uc, sizeof(*uc));
                CACHE_PERROR("enablecache: could not allocate cache data");
                return(0);
        }
        BZERO(uc->uc_entries, cache_ptr, size * SPARSENESS);
        uc->uc_fifo = ALLOC(cache_ptr, size);
        if (uc->uc_fifo == NULL) {
+               mem_free(uc->uc_entries, sizeof(struct udp_cache)*size * SPARSENESS);
+               mem_free(uc, sizeof(struct udp_cache));
                CACHE_PERROR("enablecache: could not allocate cache fifo");
                return(0);
        }
@@ -488,6 +494,7 @@ cache_set(xprt, replylen)
                }
                newbuf = mem_alloc(su->su_iosz);
                if (newbuf == NULL) {
+                       mem_free(victim, sizeof(*victim));
                        CACHE_PERROR("cache_set: could not allocate new rpc_buffer");
                        return;
                }