SRW/SRU 1.1
[yaz-moved-to-github.git] / src / soap.c
index ebcf158..f33f2de 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 2002-2003, Index Data.
  * See the file LICENSE for details.
  *
- * $Id: soap.c,v 1.1 2003-10-27 12:21:35 adam Exp $
+ * $Id: soap.c,v 1.3 2003-12-20 00:51:19 adam Exp $
  */
 
 #include <yaz/soap.h>
@@ -111,6 +111,12 @@ int z_soap_codec_enc(ODR o, Z_SOAP **pp,
             return z_soap_error(o, p, "SOAP-ENV:Client",
                                 "SOAP No content for Body", 0);
         }
+        if (!ptr->ns)
+        {
+            xmlFreeDoc(doc);
+            return z_soap_error(o, p, "SOAP-ENV:Client",
+                                "SOAP No namespace for content", 0);
+        }
         /* check for fault package */
         if (!strcmp(ptr->ns->href, p->ns)
             && !strcmp(ptr->name, "Fault") && ptr->children)
@@ -204,7 +210,10 @@ int z_soap_codec_enc(ODR o, Z_SOAP **pp,
                                     handlers[no].client_data,
                                     handlers[no].ns);
             if (ret)
+           {
+               xmlFreeDoc(doc);
                 return ret;
+           }
         }
         if (p->which == Z_SOAP_generic && !strcmp(p->ns, "SRU"))
         {