Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 May 1997 09:34:50 -0600 (MDT)
From:      Steve Bauer <sbauer@rock.sdsmt.edu>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/3494: memory allocation error in threaded file descriptor table for in uthead_init.c
Message-ID:  <199705041534.JAA00639@rock.sdsmt.edu>
Resent-Message-ID: <199705041550.IAA00434@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



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