discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] bug in gri_fft.cc


From: Johnathan Corgan
Subject: Re: [Discuss-gnuradio] bug in gri_fft.cc
Date: Sat, 29 Jun 2013 09:38:08 -0700

On Thu, Jun 27, 2013 at 1:43 AM, Marek Czerski <address@hidden> wrote:
 
I found a bug in gnuradio-core/src/lib/general/gri_fft.cc, in function:
static const char * wisdom_filename ()

It returns pointer to char string from temporary object created by call to path.string(). Obviously, this pointer is pointing to garbage after exit from wisdom_filename() function.

The current usage is correct.  The object "path" is declared (in line 79) with "static local" scope, which means that it persists in between calls to the function. In line 80, it is assigned a value, and the return value from the function is a const pointer to the internal storage of the object.

A reasonable explanation of "static local" scope is here:

https://en.wikipedia.org/wiki/Local_variable#Static_local_variables

--
Johnathan Corgan
Corgan Labs - SDR Training and Development Services
http://corganlabs.com
reply via email to

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