If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Process leaks file if it is a tty and it hits a line error or a buffer error

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: timeless, Assigned: timeless)

Tracking

({coverity, mlk})

Trunk
x86
Linux
coverity, mlk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fixed-in-tracemonkey])

Attachments

(1 attachment)

(Assignee)

Description

7 years ago
385 Process(JSContext *cx, JSObject *obj, char *filename, JSBool forceTTY)
398     if (forceTTY || !filename || strcmp(filename, "-") == 0) {
400     } else {
401         file = fopen(filename, "r");

414     if (!forceTTY && !isatty(fileno(file)))
416     {
444         if (file != stdin)
445             fclose(file);
446         return;
447     }

449     /* It's an interactive filehandle; drop into read-eval-print loop. */
454     do {
463         do {
473             if (!line) {
474                 if (errno) {
475                     JS_ReportError(cx, strerror(errno));
476                     free(buffer);

leaks file != stdin:
477                     return;
481             }
482             if (!buffer) {
486             } else {
491                 if (newlen + 1 > size) {
494                     if (!newBuf) {
495                         free(buffer);
496                         free(line);
497                         JS_ReportOutOfMemory(cx);
leaks file != stdin:
498                         return;

514         } while (!JS_BufferIsCompilableUnit(cx, obj, buffer, len));

545     } while (!hitEOF && !gQuitting);

549     if (file != stdin)
550         fclose(file);
551     return;
552 }
(Assignee)

Comment 1

7 years ago
Created attachment 466577 [details] [diff] [review]
cleanup
Assignee: general → timeless
Status: NEW → ASSIGNED
Attachment #466577 - Flags: review?(jorendorff)
Attachment #466577 - Flags: review?(jorendorff) → review+
(Assignee)

Comment 2

7 years ago
we don't ship shell so while it is part of the build it shouldn't need approval... or someone could just merge this into tracemonkey.
Keywords: checkin-needed
OS: Linux → Windows CE
http://hg.mozilla.org/tracemonkey/rev/9df99367ef2b
Keywords: checkin-needed
Whiteboard: [fixed-in-tracemonkey]

Comment 4

7 years ago
http://hg.mozilla.org/mozilla-central/rev/9df99367ef2b
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
(Assignee)

Updated

7 years ago
OS: Windows CE → Linux
You need to log in before you can comment on or make changes to this bug.