aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-09 04:31:38 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-09 04:31:38 +0000
commitc23a82df3d893f525a52da48a638fcf30dd51abe (patch)
tree8833bc6f89dc013402311310e901f6db1e7430d6 /main
parentb4d44bd078c4c4988f0b406923bd47eeb6bc0230 (diff)
Add debugging mode for diagnosing file descriptor leaks.
(Related to issue #14625) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@187300 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/Makefile2
-rw-r--r--main/asterisk.c1
-rw-r--r--main/file.c9
3 files changed, 8 insertions, 4 deletions
diff --git a/main/Makefile b/main/Makefile
index 38d49f34c..1bd3cd4b1 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -22,7 +22,7 @@ OBJS= io.o sched.o logger.o frame.o loader.o config.o channel.o \
ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
- astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
+ astmm.o astfd.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
diff --git a/main/asterisk.c b/main/asterisk.c
index eb79e71a1..e0fbcc303 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -2732,6 +2732,7 @@ int main(int argc, char *argv[])
ast_builtins_init();
ast_utils_init();
tdd_init();
+ ast_fd_init();
if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
diff --git a/main/file.c b/main/file.c
index faca5a9be..8e8388014 100644
--- a/main/file.c
+++ b/main/file.c
@@ -332,8 +332,10 @@ static void filestream_destructor(void *arg)
free(f->filename);
if (f->realfilename)
free(f->realfilename);
- if (f->fmt->close)
- f->fmt->close(f);
+ if (f->fmt->close) {
+ void (*closefn)(struct ast_filestream *) = f->fmt->close;
+ closefn(f);
+ }
if (f->f)
fclose(f->f);
if (f->vfs)
@@ -371,8 +373,9 @@ static int fn_wrapper(struct ast_filestream *s, const char *comment, enum wrap_f
{
struct ast_format *f = s->fmt;
int ret = -1;
+ int (*openfn)(struct ast_filestream *s);
- if (mode == WRAP_OPEN && f->open && f->open(s))
+ if (mode == WRAP_OPEN && (openfn = f->open) && openfn(s))
ast_log(LOG_WARNING, "Unable to open format %s\n", f->name);
else if (mode == WRAP_REWRITE && f->rewrite && f->rewrite(s, comment))
ast_log(LOG_WARNING, "Unable to rewrite format %s\n", f->name);