[Top][All Lists]

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

Re: [Gnash-commit] gnash ChangeLog libamf/amf.cpp server/vm/Action...

From: strk
Subject: Re: [Gnash-commit] gnash ChangeLog libamf/amf.cpp server/vm/Action...
Date: Sun, 18 May 2008 18:24:43 +0200

On Sun, May 18, 2008 at 05:59:05PM +0200, Rob Savoye wrote:
> strk wrote:
> >I'm fine to revert, but the patch DOES fix a bug in amf.cpp.
> >The patch is the code used 'delete' against memory allocated
> >by 'malloc' (deep in strnup).
>   It's a valgrind bug, not an amf.cpp one.

Is the following code bugless in your opinion ?

  #include <string.h>
  #include <stdio.h>
  int main() {
          char* ch = strndup("test", 4);
          printf("%s\n", ch);
          delete ch;
          return 0;

>   Like I suggested, if you're gonna fix this bug, please fix it right. 
> :-) Type casting tmpptr to name, rather than allocating memory via 
> strndup() it the way it should work.

Can do that as well, if you don't need debugging messages anymore.
Or we can have log_debug take temporary std::string for the sole
purpose of adding the terminating null..

But really is just an optimization, as long as you're modifying
that code anyway what is it worth ?


reply via email to

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