Dan Hipschman : widl: Add calls to NdrFooFree for more types in server stubs.

Alexandre Julliard julliard at winehq.org
Thu Sep 13 07:17:28 CDT 2007


Module: wine
Branch: master
Commit: 177346f1b6825a4f7425369612004402d6a0ef12
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=177346f1b6825a4f7425369612004402d6a0ef12

Author: Dan Hipschman <dsh at linux.ucla.edu>
Date:   Wed Sep 12 16:08:43 2007 -0700

widl: Add calls to NdrFooFree for more types in server stubs.

---

 tools/widl/typegen.c |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 89d3d60..e95b8c6 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2423,6 +2423,17 @@ static inline int is_size_needed_for_phase(enum remoting_phase phase)
     return (phase != PHASE_UNMARSHAL);
 }
 
+static int needs_freeing(const attr_list_t *attrs, const type_t *t, int out)
+{
+    return
+        (is_user_type(t)
+         || (is_ptr(t)
+             && (t->ref->type == RPC_FC_IP
+                 || is_ptr(t->ref))))
+        || (out && (is_string_type(attrs, t)
+                    || is_array(t)));
+}
+
 void write_remoting_arguments(FILE *file, int indent, const func_t *func,
                               enum pass pass, enum remoting_phase phase)
 {
@@ -2453,17 +2464,23 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
         if (!in_attr && !out_attr)
             in_attr = 1;
 
-        switch (pass)
+        if (phase == PHASE_FREE)
         {
-        case PASS_IN:
-            if (!in_attr) continue;
-            break;
-        case PASS_OUT:
-            if (!out_attr) continue;
-            break;
-        case PASS_RETURN:
-            break;
+            if (!needs_freeing(var->attrs, type, out_attr))
+                continue;
         }
+        else
+            switch (pass)
+            {
+            case PASS_IN:
+                if (!in_attr) continue;
+                break;
+            case PASS_OUT:
+                if (!out_attr) continue;
+                break;
+            case PASS_RETURN:
+                break;
+            }
 
         rtype = type->type;
 




More information about the wine-cvs mailing list