gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] Re: patch: malloc(0) and array bound violation


From: Paul Pogonyshev
Subject: Re: [gnugo-devel] Re: patch: malloc(0) and array bound violation
Date: Thu, 24 Jun 2004 00:33:43 +0300
User-agent: KMail/1.6.52

Teun wrote:
> I wrote:
> 
> > The problem with malloc(0) returning 0, leading to assertion failures has 
> > not
> > been fixed to date. For a message on this subject see e.g.
> > 
> > http://lists.gnu.org/archive/html/gnugo-devel/2004-02/msg00037.html
> > 
> > 
> > One part of the attached patch (for owl.c) is an update for this problem 
> > for 3.5.8.
> 
> This patch was buggy. It contained an excess malloc() invocation.
> Revised patch attached.

-    free(list->pattern_list);
-    free(list->pattern_heap);
+    free(list->pattern_list); list->pattern_list = NULL;
+    free(list->pattern_heap); list->pattern_heap = NULL;

I assume this is done to make the function reentrant.  But I don't
understand what for?

Also, please don't write multiple statements on one line.

Paul


P.S.  Please add `-p' to your `cvs diff' options in `~/.cvsrc'.  This
      makes the location of changes immediatly obvious from the patch
      in most cases (like in Arend's and my patches).  This is a request
      for everyone :)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]