From owner-freebsd-bugs Sun May 4 08:50:04 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id IAA00453 for bugs-outgoing; Sun, 4 May 1997 08:50:04 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.5/8.8.5) id IAA00434; Sun, 4 May 1997 08:50:02 -0700 (PDT) Resent-Date: Sun, 4 May 1997 08:50:02 -0700 (PDT) Resent-Message-Id: <199705041550.IAA00434@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, sbauer@rock.sdsmt.edu Received: from krypton.hpc.sdsmt.edu (uurock@krypton.hpc.sdsmt.edu [151.159.81.5]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id IAA00196 for ; Sun, 4 May 1997 08:44:18 -0700 (PDT) Received: (from uurock@localhost) by krypton.hpc.sdsmt.edu (8.8.5/8.8.5) id JAA14592 for FreeBSD-gnats-submit@freebsd.org; Sun, 4 May 1997 09:44:15 -0600 Received: (from root@localhost) by rock.sdsmt.edu (8.8.5/8.8.5) id JAA00639; Sun, 4 May 1997 09:34:50 -0600 (MDT) Message-Id: <199705041534.JAA00639@rock.sdsmt.edu> Date: Sun, 4 May 1997 09:34:50 -0600 (MDT) From: Steve Bauer Reply-To: sbauer@rock.sdsmt.edu To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/3494: memory allocation error in threaded file descriptor table for in uthead_init.c Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 3494 >Category: kern >Synopsis: memory allocation error in libc_r -- uthread_init.c >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 4 08:50:01 PDT 1997 >Last-Modified: >Originator: Steve Bauer >Organization: South Dakota School of Mines and Technology >Release: FreeBSD 2.2-STABLE i386 >Environment: The machine is currently running FreeBSD 2.2-Stable with ctm patch 0263 applied. >Description: There is an error in the way that the memory is allocated for the file descriptor table in the thread library libc_r. The error is in the file uthread_init.c at line 172. What is happening is that instead of allocating an array of pointers to struct fd_table_entry it is allocating an array of stuct fd_table_entry. This does not cause a problem except that it wastes memory. >How-To-Repeat: This doesn't cause a major problem except to waste memory. >Fix: Below is a context diff that fixes the problem: *** uthread_init.c.orig Mon Apr 28 22:29:03 1997 --- uthread_init.c Sun May 4 09:21:12 1997 *************** *** 169,175 **** PANIC("Cannot get dtablesize"); } /* Allocate memory for the file descriptor table: */ ! if ((_thread_fd_table = (struct fd_table_entry **) malloc(sizeof(struct fd_table_entry) * _thread_dtablesize)) == NULL) { /* * Cannot allocate memory for the file descriptor * table, so abort this process. --- 169,175 ---- PANIC("Cannot get dtablesize"); } /* Allocate memory for the file descriptor table: */ ! if ((_thread_fd_table = (struct fd_table_entry **) malloc(sizeof(struct fd_table_entry *) * _thread_dtablesize)) == NULL) { /* * Cannot allocate memory for the file descriptor * table, so abort this process. >Audit-Trail: >Unformatted: