Module: kamailio
Branch: master
Commit: 478310c56f0eb060c5f31b2ee8febbb6204d37e7
URL: 
https://github.com/kamailio/kamailio/commit/478310c56f0eb060c5f31b2ee8febbb6204d37e7

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-01-31T20:23:11+01:00

pv: small reworking of pointer conditions

---

Modified: src/modules/pv/pv_core.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/478310c56f0eb060c5f31b2ee8febbb6204d37e7.diff
Patch: 
https://github.com/kamailio/kamailio/commit/478310c56f0eb060c5f31b2ee8febbb6204d37e7.patch

---

diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 3963ead97f9..38d46c01dba 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -3654,7 +3654,7 @@ int pv_set_xto_attr(struct sip_msg *msg, pv_param_t 
*param, int op,
                        }
 
                        buf.s = pkg_malloc(val->rs.len);
-                       if(buf.s == 0) {
+                       if(buf.s == NULL) {
                                LM_ERR("no more pkg mem\n");
                                goto error;
                        }
@@ -3681,7 +3681,7 @@ int pv_set_xto_attr(struct sip_msg *msg, pv_param_t 
*param, int op,
                                return -1;
                        }
                        buf.s = pkg_malloc(val->rs.len + 1);
-                       if(buf.s == 0) {
+                       if(buf.s == NULL) {
                                LM_ERR("no more pkg mem\n");
                                goto error;
                        }
@@ -3708,7 +3708,7 @@ int pv_set_xto_attr(struct sip_msg *msg, pv_param_t 
*param, int op,
                                return -1;
                        }
                        buf.s = pkg_malloc(val->rs.len);
-                       if(buf.s == 0) {
+                       if(buf.s == NULL) {
                                PKG_MEM_ERROR;
                                goto error;
                        }
@@ -3735,7 +3735,7 @@ int pv_set_xto_attr(struct sip_msg *msg, pv_param_t 
*param, int op,
                                return -1;
                        }
                        buf.s = pkg_malloc(val->rs.len + 1);
-                       if(buf.s == 0) {
+                       if(buf.s == NULL) {
                                LM_ERR("no more pkg mem\n");
                                goto error;
                        }
@@ -3790,7 +3790,7 @@ int pv_set_xto_attr(struct sip_msg *msg, pv_param_t 
*param, int op,
                        goto error;
                }
        } else {
-               if(buf.s != 0) {
+               if(buf.s != NULL) {
                        pkg_free(buf.s);
                        buf.s = NULL;
                }
@@ -3817,8 +3817,9 @@ int pv_set_xto_attr(struct sip_msg *msg, pv_param_t 
*param, int op,
        return 0;
 
 error:
-       if(buf.s != 0)
+       if(buf.s != NULL) {
                pkg_free(buf.s);
+       }
        return -1;
 }
 

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to