Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Aug 2003 11:50:54 +0800
From:      Eugene Grosbein <eugen@kuzbass.ru>
To:        Doug White <dwhite@gumbysoft.com>
Cc:        bug-followup@freebsd.org
Subject:   Re: bin/55346: /bin/sh eats memory and CPU infinitely
Message-ID:  <3F3EFB9E.B69ADCB9@kuzbass.ru>
References:  <20030815211321.A11482@grosbein.pp.ru> <20030815191010.S16351@carver.gumbysoft.com> <20030816120012.A24906@carver.gumbysoft.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Doug White wrote:

> Ah, OK, I follow you there. send-pr away.

It seems that patch replaces memory leak with double-free bug:
waitforjob() will call freejob() just after dowait().

This corrected version removes extra freejob() call.

--- jobs.c.orig Mon Aug  4 11:48:00 2003
+++ jobs.c      Sun Aug 17 11:20:55 2003
@@ -889,8 +889,6 @@
 #endif
        else
                st = WTERMSIG(status) + 128;
-       if (! JOBS || jp->state == JOBDONE)
-               freejob(jp);
        if (int_pending()) {
                if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
                        kill(getpid(), SIGINT);
@@ -960,10 +958,8 @@
                                if (jp->state != state) {
                                        TRACE(("Job %d: changing state from %d
to %d\n", jp -
jobtab + 1, jp->state, state));
                                        jp->state = state;
-#if JOBS
                                        if (done)
-                                               deljob(jp);
-#endif
+                                               freejob(jp);
                                }
                        }
                }


Eugene Grosbein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F3EFB9E.B69ADCB9>