# Weird malloc/free crash in pm\_remez.cc

**URL:** <https://www.ruby-forum.com/t/weird-malloc-free-crash-in-pm-remez-cc/237697>\
**Category:** GNU Radio\
**Created:** [November 25, 2013, 3:04am UTC](https://www.ruby-forum.com/t/weird-malloc-free-crash-in-pm-remez-cc/237697 "2013-11-25T03:04:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [November 25, 2013, 3:04am UTC](https://www.ruby-forum.com/t/weird-malloc-free-crash-in-pm-remez-cc/237697/1 "2013-11-25T03:04:18Z")

</div>

Hi all,

Ive got an annoying crash in the current head of gnuradio. Its  
reproducible with the GRC file up at:

[http://www.joshisanerd.com/am\_demod\_crash.grc](http://www.joshisanerd.com/am_demod_crash.grc)

Does this crash for anyone else? If nobody else can repro, this is  
probably something thats hosed in my environment. Until someone else  
can confirm this, its probably not worth looking into for anyone else.

For me, the crash is at pm\_remez.cc:698, the free(Grid) call in the  
error handler. (Its coming from an error code of -2, which is probably  
due to my putting in totally insane parameters or some such.)

The odd thing is that it doesnt look like it should be crashing in this  
code path. The pointer its freeing is totally fine when I step through  
with gdb: the same as the mallocd value, and no intervening free()  
calls, yet its still crashing when it gets free()d. When I move the  
free(Grid) line around, the crash follows it. It doesnt look like  
anything else is getting screwed up, so I dont know what to make of  
this.

(FWIW, my goal is to poke around at decoding RDS. Ive removed a lot of  
stuff to get down to this minimal program that shows the problem. Ive  
gotten the AM demod stuff sorta working in ipython, and am now trying to  
port it back to gnuradio pointers on anything thats clearly wrong with  
my design there would be appreciated.)

/jbm

---

<div class="post-metadata">

**Author:** ![skiz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e99b99/32.png) [@skiz](https://www.ruby-forum.com/u/skiz)\
**Post date:** [November 26, 2013, 4:31am UTC](https://www.ruby-forum.com/t/weird-malloc-free-crash-in-pm-remez-cc/237697/2 "2013-11-26T04:31:34Z")

</div>

On Mon, Nov 25, 2013 at 10:12 PM, Mark Cottrell  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > probably something thats hosed in my environment. Until someone else can  
> > line around, the crash follows it. It doesnt look like anything else is  
> > Discuss-gnuradio mailing list  
> > This email, including any attachments, is only for the intended recipient.  
> > damage or interfere with recipient data, hardware or software. The recipient  
> > relies upon its own procedures and assumes all risk of use and of opening  
> > any attachments.

You set the audio passband in the AM Demod to 0, which is what’s  
causing the problem. That’s a bogus passband value, though it  
shouldn’t be causing a memory crash. We’ll have to protect against  
this instead of just letting it crash.

Thanks for the report.

Tom

---

<div class="post-metadata">

**Author:** ![skiz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e99b99/32.png) [@skiz](https://www.ruby-forum.com/u/skiz)\
**Post date:** [November 26, 2013, 4:14am UTC](https://www.ruby-forum.com/t/weird-malloc-free-crash-in-pm-remez-cc/237697/3 "2013-11-26T04:14:02Z")

</div>

On Mon, Nov 25, 2013 at 3:03 PM, Josh M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

I was able to reproduce your problem with the linked grc file. I’m  
running  
gnuradio 3.7.2git-171-g362b0fb6 in debian jessie, and I have absolutely  
no  
idea what would be causing it, sorry. At least now it seems as though  
it  
isn’t isolated to a problem with your environment.

–

* * *

This email, including any attachments, is only for the intended  
recipient.  
It is subject to copyright, is confidential and may be the subject of  
legal  
or other privilege, none of which is waived or lost by reason of this  
transmission.  
If you are not an intended recipient, you may not use, disseminate,  
distribute or reproduce such email, any attachments, or any part  
thereof.  
If you have received a message in error, please notify the sender  
immediately and erase all copies of the message and any attachments.  
Unfortunately, we cannot warrant that the email has not been altered or  
corrupted during transmission nor can we guarantee that any email or any  
attachments are free from computer viruses or other conditions which may  
damage or interfere with recipient data, hardware or software. The  
recipient relies upon its own procedures and assumes all risk of use and  
of  
opening any attachments.
