delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/01/05/10:12:39

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200201051512.QAA11293@father.ludd.luth.se>
Subject: Re: Memory leaks fixes
In-Reply-To: <3C36F39E.D32EDD38@phekda.freeserve.co.uk> from Richard Dawe at "Jan 5, 2002 12:37:50 pm"
To: djgpp-workers AT delorie DOT com
Date: Sat, 5 Jan 2002 16:12:34 +0100 (MET)
X-Mailer: ELM [version 2.4ME+ PL54 (25)]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

According to Richard Dawe:
> Any comments appreciated. Thanks, bye, Rich =]
> 
> -- 
> Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
> 
> Index: src/libc/fsext/fsext.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/fsext/fsext.c,v
> retrieving revision 1.3
> diff -p -u -3 -r1.3 fsext.c
> --- src/libc/fsext/fsext.c      2000/06/29 08:37:09     1.3
> +++ src/libc/fsext/fsext.c      2002/01/05 12:27:35
> @@ -1,3 +1,4 @@
> +/* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
>  /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
>  /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
>  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
> @@ -88,11 +89,19 @@ grow_table(int _fd)
>  
>    if (num_fds <= _fd)
>    {
> +    __FSEXT_entry *temp;
>      int old_fds = num_fds, i;
> +
>      num_fds = (_fd+256) & ~255;
> -    fsext_list = (__FSEXT_entry *)realloc(fsext_list, num_fds *
> sizeof(__FSEXT_entry));
> -    if (fsext_list == 0)
> +    temp = (__FSEXT_entry *)realloc(fsext_list, num_fds *
> sizeof(__FSEXT_entry));

Isn't it bad practice to cast the return value from
malloc(). Shouldn't realloc() be treated the same?

Your mailer breaks lines. That's not good if you want us to apply the
patches.


Right,

							MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019