aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-18 16:51:54 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-18 16:51:54 +0000
commitf789484094473a3914d3cd4d99ea8950e32c15ef (patch)
tree1f8b8565fdaccde4115c617c6c1381ab56ad4dca /channels
parent0816d31618f6656fcdd348220f863a1635716bc4 (diff)
Merged revisions 201678 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r201678 | dvossel | 2009-06-18 11:37:42 -0500 (Thu, 18 Jun 2009) | 11 lines fixes some memory leaks and redundant conditions (closes issue #15269) Reported by: contactmayankjain Patches: patch.txt uploaded by contactmayankjain (license 740) memory_leak_stuff.trunk.diff uploaded by dvossel (license 671) Tested by: contactmayankjain, dvossel ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@201680 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/h323/ast_h323.cxx17
-rw-r--r--channels/misdn/isdn_lib.c4
-rwxr-xr-xchannels/xpmr/xpmr.c2
3 files changed, 13 insertions, 10 deletions
diff --git a/channels/h323/ast_h323.cxx b/channels/h323/ast_h323.cxx
index cad4c2cfc..5c35620c0 100644
--- a/channels/h323/ast_h323.cxx
+++ b/channels/h323/ast_h323.cxx
@@ -571,8 +571,7 @@ MyH323Connection::MyH323Connection(MyH323EndPoint & ep, unsigned callReference,
{
#ifdef H323_H450
/* Dispatcher will free out all registered handlers */
- if (h450dispatcher)
- delete h450dispatcher;
+ delete h450dispatcher;
h450dispatcher = new H450xDispatcher(*this);
h4502handler = new H4502Handler(*this, *h450dispatcher);
h4504handler = new MyH4504Handler(*this, *h450dispatcher);
@@ -1987,8 +1986,9 @@ void MyH323Connection::SetCapabilities(int caps, int dtmf_mode, void *_prefs, in
if (cap && cap->IsUsable(*this)) {
lastcap++;
lastcap = localCapabilities.SetCapability(0, lastcap, cap);
- } else if (cap)
+ } else {
delete cap; /* Capability is not usable */
+ }
dtmfMode = dtmf_mode;
if (h323debug) {
@@ -2000,8 +2000,9 @@ void MyH323Connection::SetCapabilities(int caps, int dtmf_mode, void *_prefs, in
cap = new H323_UserInputCapability(H323_UserInputCapability::BasicString);
if (cap && cap->IsUsable(*this)) {
lastcap = localCapabilities.SetCapability(0, lastcap, cap);
- } else if (cap)
+ } else {
delete cap; /* Capability is not usable */
+ }
sendUserInputMode = SendUserInputAsString;
} else {
if ((dtmfMode & H323_DTMF_RFC2833) != 0) {
@@ -2010,8 +2011,7 @@ void MyH323Connection::SetCapabilities(int caps, int dtmf_mode, void *_prefs, in
lastcap = localCapabilities.SetCapability(0, lastcap, cap);
else {
dtmfMode |= H323_DTMF_SIGNAL;
- if (cap)
- delete cap; /* Capability is not usable */
+ delete cap; /* Capability is not usable */
}
}
if ((dtmfMode & H323_DTMF_CISCO) != 0) {
@@ -2023,8 +2023,7 @@ void MyH323Connection::SetCapabilities(int caps, int dtmf_mode, void *_prefs, in
dtmfMode |= H323_DTMF_SIGNAL;
} else {
dtmfMode |= H323_DTMF_SIGNAL;
- if (cap)
- delete cap; /* Capability is not usable */
+ delete cap; /* Capability is not usable */
}
}
if ((dtmfMode & H323_DTMF_SIGNAL) != 0) {
@@ -2032,7 +2031,7 @@ void MyH323Connection::SetCapabilities(int caps, int dtmf_mode, void *_prefs, in
cap = new H323_UserInputCapability(H323_UserInputCapability::SignalToneH245);
if (cap && cap->IsUsable(*this))
lastcap = localCapabilities.SetCapability(0, lastcap, cap);
- else if (cap)
+ else
delete cap; /* Capability is not usable */
}
sendUserInputMode = SendUserInputAsTone; /* RFC2833 transmission handled at Asterisk level */
diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c
index 2942ecfbb..c630bc8da 100644
--- a/channels/misdn/isdn_lib.c
+++ b/channels/misdn/isdn_lib.c
@@ -2231,6 +2231,10 @@ static void misdn_save_data(int id, char *p1, int l1, char *p2, int l2)
if (!rx || !tx) {
cb_log(0,0,"Couldn't open files: %s\n",strerror(errno));
+ if (rx)
+ fclose(rx);
+ if (tx)
+ fclose(tx);
return ;
}
diff --git a/channels/xpmr/xpmr.c b/channels/xpmr/xpmr.c
index c2742cbc3..7c87410b2 100755
--- a/channels/xpmr/xpmr.c
+++ b/channels/xpmr/xpmr.c
@@ -157,7 +157,7 @@ i16 string_parse(char *src, char **dest, char ***ptrs)
TRACEJ(2,(" source len = %i\n",slen));
pd=*dest;
- if(pd) free(pd);
+ free(pd);
pd=calloc(slen+1,1);
memcpy(pd,src,slen);
*dest=pd;