mangler: pkg free in case of errors
[sip-router] / src / modules / mangler / contact_ops.c
index 90814dc..de94edb 100644 (file)
 #include "contact_ops.h"
 #include "utils.h"
 #include "common.h"
-#include "../../mem/mem.h"
-#include "../../data_lump.h"
-#include "../../parser/hf.h"
-#include "../../parser/parse_uri.h"
-#include "../../parser/contact/parse_contact.h"
-#include "../../ut.h"
-#include "../../dset.h"
+#include "../../core/mem/mem.h"
+#include "../../core/data_lump.h"
+#include "../../core/parser/hf.h"
+#include "../../core/parser/parse_uri.h"
+#include "../../core/parser/contact/parse_contact.h"
+#include "../../core/ut.h"
+#include "../../core/dset.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -73,7 +73,11 @@ encode_contact (struct sip_msg *msg, char *encoding_prefix,char *public_ip)
                if (strlen(contact_flds_separator)>=1)
                        separator = contact_flds_separator[0];
        
-       if (msg->contact->parsed == NULL)       parse_contact (msg->contact);
+       if (msg->contact->parsed == NULL) {
+               if(parse_contact (msg->contact)<0) {
+                       LM_DBG("failed to parse contact\n");
+               }
+       }
        if (msg->contact->parsed != NULL)
        {
                cb = (contact_body_t *) msg->contact->parsed;
@@ -188,8 +192,6 @@ decode_contact_header (struct sip_msg *msg,char *unused1,char *unused2)
        str newUri;
        char separator;
        int res;
-       
-       
 
        if ((msg->contact == NULL)&&((parse_headers(msg,HDR_CONTACT_F,0) == -1) || 
                                (msg->contact== NULL) ))
@@ -203,7 +205,11 @@ decode_contact_header (struct sip_msg *msg,char *unused1,char *unused2)
                if (strlen(contact_flds_separator)>=1)
                        separator = contact_flds_separator[0];
                
-       if (msg->contact->parsed == NULL) parse_contact (msg->contact);
+       if (msg->contact->parsed == NULL) {
+               if(parse_contact (msg->contact)<0) {
+                       LM_DBG("failed to parse contact\n");
+               }
+       }
        if (msg->contact->parsed != NULL)
        {
                cb = (contact_body_t *) msg->contact->parsed;