]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-xdr-free-20090401
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 1 Apr 2009 17:38:13 +0000 (17:38 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 1 Apr 2009 17:38:13 +0000 (17:38 +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.

(cherry picked from commit d7749751df230d919188546106b61bd2dbb8974c)

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 fd40ee11ee41dac4b4de1ce446fac3239a283b06..02495fc8fcd798624cebfa470c5c263762b39e1b 100644 (file)
@@ -583,4 +583,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 */