Hello All,
There is a structure sip_msg which is passed into a module and represents a received sip message.
It contains number of pointers to hdr_field members.
In its turn hdr_field contains member void* parsed
In the sanity module we assign to parsed member a pointer to newly allocated memory and we don't free that memory at the end.
Do we need to free explicitly or this memory will be deallocated later together with sip_msg ?
In other words is it memory leak or not?
Best regards,
Konstantin
Module: kamailio
Branch: 5.1
Commit: 7de9b687355f714d327b3c74a0fc63c85c9d1aee
URL: https://github.com/kamailio/kamailio/commit/7de9b687355f714d327b3c74a0fc63c…
Author: Christoph Valentin <christoph.valentin(a)kapsch.net>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-06-01T10:13:20+02:00
ims_usrloc_scscf: bugfix Contct is removed when old Contct expires
in function unlink_contact_from_impu() (in file impurecord.c) an
assignment "=" is used instead of a comparision operator "==". This
leads to mess, when old contact expires.
---
Modified: src/modules/ims_usrloc_scscf/impurecord.c
---
Diff: https://github.com/kamailio/kamailio/commit/7de9b687355f714d327b3c74a0fc63c…
Patch: https://github.com/kamailio/kamailio/commit/7de9b687355f714d327b3c74a0fc63c…
---
diff --git a/src/modules/ims_usrloc_scscf/impurecord.c b/src/modules/ims_usrloc_scscf/impurecord.c
index 9cee5bc765..6510d85aa1 100644
--- a/src/modules/ims_usrloc_scscf/impurecord.c
+++ b/src/modules/ims_usrloc_scscf/impurecord.c
@@ -1239,7 +1239,7 @@ int unlink_contact_from_impu(impurecord_t* impu, ucontact_t* contact, int write_
impucontact = impu->linked_contacts.head;
while (impucontact) {
- if ((contact = impucontact->contact)) {
+ if ((contact == impucontact->contact)) {
remove_impucontact_from_list(impu, impucontact);
if (write_to_db && db_mode == WRITE_THROUGH && (db_unlink_contact_from_impu(impu, contact) != 0)) {
LM_ERR("Failed to un-link DB contact [%.*s] from IMPU [%.*s]...continuing but db will be out of sync!\n", contact->c.len, contact->c.s, impu->public_identity.len, impu->public_identity.s);
Module: kamailio
Branch: master
Commit: 53a52f9b2caa1fd04e30747ce46f8a22834991a0
URL: https://github.com/kamailio/kamailio/commit/53a52f9b2caa1fd04e30747ce46f8a2…
Author: valentin <christoph.valentin(a)kapsch.net>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-06-01T10:12:50+02:00
ims_isc: initial fix of issue #1168
Function isc_match_filter() got a new local variable firstflag in
order to handle the case where a FAILURE_ROUTE callback is
received before the first AS has been contacted.
The firstflag is also forwarded to function isc_forward() as
parameter.
---
Modified: src/modules/ims_isc/ims_isc_mod.c
Modified: src/modules/ims_isc/isc.c
Modified: src/modules/ims_isc/isc.h
---
Diff: https://github.com/kamailio/kamailio/commit/53a52f9b2caa1fd04e30747ce46f8a2…
Patch: https://github.com/kamailio/kamailio/commit/53a52f9b2caa1fd04e30747ce46f8a2…
---
diff --git a/src/modules/ims_isc/ims_isc_mod.c b/src/modules/ims_isc/ims_isc_mod.c
index e0f7b940ee..4618ca7db1 100644
--- a/src/modules/ims_isc/ims_isc_mod.c
+++ b/src/modules/ims_isc/ims_isc_mod.c
@@ -224,6 +224,8 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t* d) {
//sometimes s is populated by an ims_getter method cscf_get_terminating_user that alloc memory that must be free-ed at the end
int free_s = 0;
+ //the callback from the Cx interface in case of unreg terminating initial message is a FAILURE_ROUTE. Hence we need an addl. flag
+ int firstflag = 0;
int ret = ISC_RETURN_FALSE;
isc_mark new_mark, old_mark;
@@ -245,9 +247,10 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t* d) {
LM_DBG("Message returned s=%d;h=%d;d=%d;a=%.*s\n", old_mark.skip, old_mark.handling, old_mark.direction, old_mark.aor.len, old_mark.aor.s);
} else {
LM_DBG("Starting triggering\n");
+ firstflag = 1;
}
- if (is_route_type(FAILURE_ROUTE)) {
+ if (is_route_type(FAILURE_ROUTE) && !firstflag) {
/* need to find the handling for the failed trigger */
if (dir == DLG_MOBILE_ORIGINATING) {
k = cscf_get_originating_user(msg, &s);
@@ -345,7 +348,7 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t* d) {
new_mark.skip = m->index + 1;
new_mark.handling = m->default_handling;
new_mark.aor = s;
- ret = isc_forward(msg, m, &new_mark);
+ ret = isc_forward(msg, m, &new_mark, firstflag);
isc_free_match(m);
goto done;
}
@@ -383,7 +386,7 @@ int isc_match_filter(struct sip_msg *msg, char *str1, udomain_t* d) {
new_mark.skip = m->index + 1;
new_mark.handling = m->default_handling;
new_mark.aor = s;
- ret = isc_forward(msg, m, &new_mark);
+ ret = isc_forward(msg, m, &new_mark, firstflag);
isc_free_match(m);
goto done;
}
diff --git a/src/modules/ims_isc/isc.c b/src/modules/ims_isc/isc.c
index 3d1fdf5c46..a095e054e7 100644
--- a/src/modules/ims_isc/isc.c
+++ b/src/modules/ims_isc/isc.c
@@ -56,7 +56,7 @@
* @param mark - the isc_mark that should be used to mark the message
* @returns #ISC_RETURN_TRUE if OK, #ISC_RETURN_ERROR if not
*/
-int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark) {
+int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark, int firstflag) {
struct cell *t;
unsigned int hash, label;
ticks_t fr_timeout, fr_inv_timeout;
@@ -75,7 +75,7 @@ int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark) {
memcpy(msg->dst_uri.s, m->server_name.s, m->server_name.len);
/* append branch if last trigger failed */
- if (is_route_type(FAILURE_ROUTE))
+ if (is_route_type(FAILURE_ROUTE) && !firstflag)
append_branch(msg, &(msg->first_line.u.request.uri), &(msg->dst_uri), 0, Q_UNSPECIFIED, 0, 0, 0, 0, 0, 0);
// Determines the tm transaction identifiers.
diff --git a/src/modules/ims_isc/isc.h b/src/modules/ims_isc/isc.h
index 8c3715e347..ac012162fd 100644
--- a/src/modules/ims_isc/isc.h
+++ b/src/modules/ims_isc/isc.h
@@ -66,7 +66,7 @@ extern int isc_fr_inv_timeout; /**< default ISC INVITE response timeout in ms *
/** SIP Status Code to send to client on Session Termination because AS did not respond */
-int isc_forward( struct sip_msg *msg, isc_match *m,isc_mark *mark);
+int isc_forward( struct sip_msg *msg, isc_match *m,isc_mark *mark, int firstflag);
#endif
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
This commits adding some new functions to Get and Change forwarding info in ISUP part of SIP-I/SIP-T messages.
sipt_forwarding(origin, nai) - updates the IAM in the body if it exists, setting (or adding) the forwarding number to origin with the nature address specified in nai
$sipt_redirection_info - Returns "Redirecting reason" or -1 if no redirection info found.
$sipt_redirection_number - Returns number to which redirection will trigered
sipt_redirection_number_nai - Returns NAI for redirection number from ISUP
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1498
-- Commit Summary --
* sipt: Add functions to work with forwarding info (#18)
-- File Changes --
M src/modules/sipt/doc/sipt_admin.xml (72)
M src/modules/sipt/sipt.c (149)
M src/modules/sipt/ss7.h (6)
M src/modules/sipt/ss7_parser.c (138)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1498.patchhttps://github.com/kamailio/kamailio/pull/1498.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1498
to avoid null pointer access for malformed messages
#### Pre-Submission Checklist
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [x] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
after adding modparam("dialog", "track_cseq_updates", 1) and getting some malformed SIP kamailio crushed
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1552
-- Commit Summary --
* dialog: check CSeq careful with track_cseq_updates
-- File Changes --
M src/modules/dialog/dlg_cseq.c (3)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1552.patchhttps://github.com/kamailio/kamailio/pull/1552.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1552