Hello.

mg(1) editor has a small resource leak in make_file_list() function.
If it cannot allocate space for `current' list it returns without
closing `dirp' with closedir() call.

Index: fileio.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/fileio.c,v
retrieving revision 1.84
diff -U 3 -p -r1.84 fileio.c
--- fileio.c    21 Jan 2011 19:10:13 -0000      1.84
+++ fileio.c    18 Mar 2011 19:55:18 -0000
@@ -551,6 +551,7 @@ make_file_list(char *buf)
 
                if ((current = malloc(sizeof(struct list))) == NULL) {
                        free_file_list(last);
+                       closedir(dirp);
                        return (NULL);
                }
                ret = snprintf(fl_name, sizeof(fl_name),

Reply via email to