probably shouldn't leave the mmap'ed file hanging around in memory
authorKevin P. Fleming <kpfleming@digium.com>
Sat, 6 Jan 2007 00:02:06 +0000 (00:02 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Sat, 6 Jan 2007 00:02:06 +0000 (00:02 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49735 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index dead94f..b154402 100644 (file)
@@ -2775,8 +2775,10 @@ static struct ast_str *generic_http_callback(enum output_format format,
                fclose(s->f);
                if (format == FORMAT_XML || format == FORMAT_HTML) {
                        if (l) {
-                               if ((buf = mmap(NULL, l, PROT_READ, MAP_SHARED, s->fd, 0)))
+                               if ((buf = mmap(NULL, l, PROT_READ, MAP_SHARED, s->fd, 0))) {
                                        xml_translate(&out, buf, params, format);
+                                       munmap(buf, l);
+                               }
                        } else {
                                xml_translate(&out, "", params, format);
                        }