]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
xdr-free-20090401
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 1 Apr 2009 17:37:50 +0000 (17:37 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 1 Apr 2009 17:37:50 +0000 (17:37 +0000)
LICENSE MIT

add xdr_free() and export it from afsrpc.dll.  This permits applications
to free memory allocated within the xdr routines with the same run time
library memory management routines as was used to allocate it.

This is necessary on Windows to prevent memory corruption.

VL_GetAddrsU() is an example where a xdr array is allocated in the
library and must be freed by the application.

src/libafsrpc/afsrpc.def
src/rx/xdr.c
src/rx/xdr_prototypes.h

index 8459dc24f6c18816be6460219a4dfcf79a019069..54c31d18374f7592deed1c422e7996822352694d 100644 (file)
@@ -244,6 +244,7 @@ EXPORTS
         rx_WritevAlloc                          @249
         rx_ReadProc32                           @250
         rx_WriteProc32                          @251
+        xdr_free                                @252
 
 ; for performance testing
         rx_TSFPQGlobSize                        @2001 DATA
index 776c2a12d54ea74d9aa0571a0aca7c22963cc0e2..4819b6e481854cd2cfbf269ccc40c76860e9e9ae 100644 (file)
@@ -584,4 +584,10 @@ xdr_wrapstring(XDR * xdrs, char **cpp)
     return (FALSE);
 }
 #endif
+
+void 
+xdr_free(void *x, afs_int32 size)
+{
+    osi_free(x, size);
+}
 #endif /* NeXT */
index ef53d87f8c14cf3fb31d71e19a2436bba7fcd325..a24f928bd216e20bfe675e04b707f037aeb6b9c0 100644 (file)
@@ -58,6 +58,7 @@ extern bool_t xdr_union(XDR * xdrs, enum_t * dscmp, caddr_t unp,
                        struct xdr_discrim *choices, xdrproc_t dfault);
 extern bool_t xdr_string(XDR * xdrs, char **cpp, u_int maxsize);
 extern bool_t xdr_wrapstring(XDR * xdrs, char **cpp);
+extern void   xdr_free(void *x, afs_int32 size);
 
 
 /* xdr_float.c */