SHA256
1
0
forked from pool/gsoap
gsoap/gsoap-allocator.diff

54 lines
1.3 KiB
Diff

References: http://sf.net/p/gsoap2/bugs/1007/
---
gsoap/stdsoap2.cpp | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
Index: gsoap-2.8.22/gsoap/stdsoap2.cpp
===================================================================
--- gsoap-2.8.22.orig/gsoap/stdsoap2.cpp
+++ gsoap-2.8.22/gsoap/stdsoap2.cpp
@@ -7254,7 +7254,13 @@ SOAP_FMAC1
struct soap*
SOAP_FMAC2
soap_versioning(soap_new)(soap_mode imode, soap_mode omode)
-{ struct soap *soap = (struct soap*)malloc(sizeof(struct soap));
+{
+#ifdef __cplusplus
+ struct soap *soap = new struct soap;
+#else
+ struct soap *soap = malloc(sizeof(struct soap));
+ soap->dummy = NULL;
+#endif
if (soap)
soap_versioning(soap_init)(soap, imode, omode);
return soap;
@@ -7268,7 +7274,11 @@ void
SOAP_FMAC2
soap_free(struct soap *soap)
{ soap_done(soap);
+#ifdef __cplusplus
+ SOAP_DELETE(soap);
+#else
free(soap);
+#endif
}
#endif
@@ -8981,7 +8991,14 @@ SOAP_FMAC1
struct soap*
SOAP_FMAC2
soap_copy(const struct soap *soap)
-{ return soap_copy_context((struct soap*)malloc(sizeof(struct soap)), soap);
+{
+#ifdef __cplusplus
+ return soap_copy_context(new struct soap, soap);
+#else
+ struct soap *s = malloc(sizeof(struct soap));
+ s->dummy = NULL;
+ return soap_copy_context(s, soap);
+#endif
}
#endif