aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-11-06 15:44:44 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-11-06 15:44:44 +0000
commit454d11c0929163235e0fa59840f854e525a17dbf (patch)
tree05e47eb57021021bd3bc78e07220af3df7490705 /main
parent9369a7c6f20d10f33316211b0924b5e352696589 (diff)
Merged revisions 228339 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r228339 | dvossel | 2009-11-06 09:42:46 -0600 (Fri, 06 Nov 2009) | 12 lines Merged revisions 228338 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r228338 | dvossel | 2009-11-06 09:41:41 -0600 (Fri, 06 Nov 2009) | 5 lines fixes crash in astfd.c (closes issue #15981) Reported by: slavon ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@228342 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/astfd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/main/astfd.c b/main/astfd.c
index 6a9f70e42..90ded390f 100644
--- a/main/astfd.c
+++ b/main/astfd.c
@@ -130,15 +130,16 @@ int __ast_fdleak_pipe(int *fds, const char *file, int line, const char *func)
#undef socket
int __ast_fdleak_socket(int domain, int type, int protocol, const char *file, int line, const char *func)
{
- char sdomain[20], stype[20], *sproto;
+ char sdomain[20], stype[20], *sproto = NULL;
struct protoent *pe;
int res = socket(domain, type, protocol);
if (res < 0 || res > 1023) {
return res;
}
- pe = getprotobynumber(protocol);
- sproto = pe->p_name;
+ if ((pe = getprotobynumber(protocol))) {
+ sproto = pe->p_name;
+ }
if (domain == PF_UNIX) {
ast_copy_string(sdomain, "PF_UNIX", sizeof(sdomain));
@@ -162,7 +163,11 @@ int __ast_fdleak_socket(int domain, int type, int protocol, const char *file, in
snprintf(stype, sizeof(stype), "%d", type);
}
- STORE_COMMON(res, "socket", "%s,%s,\"%s\"", sdomain, stype, sproto);
+ if (sproto) {
+ STORE_COMMON(res, "socket", "%s,%s,\"%s\"", sdomain, stype, sproto);
+ } else {
+ STORE_COMMON(res, "socket", "%s,%s,\"%d\"", sdomain, stype, protocol);
+ }
return res;
}