Closed Bug 587670 Opened 15 years ago Closed 15 years ago

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

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, memory-leak, Whiteboard: [fixed-in-tracemonkey])

Attachments

(1 file)

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 }
Attached patch cleanupSplinter Review
Assignee: general → timeless
Status: NEW → ASSIGNED
Attachment #466577 - Flags: review?(jorendorff)
Attachment #466577 - Flags: review?(jorendorff) → review+
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
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
OS: Windows CE → Linux
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: