From 3fdf12ca117212ddbddfef58ad908e8c6a6bbf4b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 20 Jan 2006 19:54:07 +0000 Subject: [PATCH] (Fload): Don't leak the file descriptor returned by openp if we are going to signal an error. --- src/ChangeLog | 3 +++ src/lread.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 51b607477c6..a67b97bc370 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2006-01-20 Eli Zaretskii + * lread.c (Fload): Don't leak the file descriptor returned by + openp if we are going to signal an error. + * w32.c (sys_close): If FD is outside [0..MAXDESC) limits, pass it directly to _close. (sys_dup): Protect against new_fd larger than fd_info[] can handle. diff --git a/src/lread.c b/src/lread.c index 4d9ddfbd009..7be2ad8fa9b 100644 --- a/src/lread.c +++ b/src/lread.c @@ -801,8 +801,12 @@ Return t if file exists. */) if (!NILP (Fequal (found, XCAR (tem)))) count++; if (count > 3) - Fsignal (Qerror, Fcons (build_string ("Recursive load"), - Fcons (found, Vloads_in_progress))); + { + if (fd >= 0) + emacs_close (fd); + Fsignal (Qerror, Fcons (build_string ("Recursive load"), + Fcons (found, Vloads_in_progress))); + } record_unwind_protect (record_load_unwind, Vloads_in_progress); Vloads_in_progress = Fcons (found, Vloads_in_progress); } -- 2.39.2