Re: [LAD] C - Change in memory causing seg.fault (but why?)

From: Jacob <jacob01@email-addr-hidden>
Date: Fri Nov 09 2012 - 02:58:07 EET

On 11/08/2012 10:18 PM, Muffinman wrote:
> On 08-11-12 22:02, Brett McCoy wrote:
>>
>> You never allocate memory for the pointer long *outvl after you create
>> it, but then try to point to a value. You need to use malloc() to
>> initialize the memory for that pointer before you can use it.
>>
>
>
> Thanks!! I believe I have some more reading to do.

And, BTW, pay attention to the "format ‘%i’ expects type ‘int’" type of
warnings. Using the wrong or omitting required length modifiers can lead
to segfaults, too. Even if '%d' and '%ld' refer to integers of the same
size on an i386 platform, on a 64 bit platform they won't and weird
things can happen if the argument doesn't match the format spec.

Jacob

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Nov 9 04:15:02 2012

This archive was generated by hypermail 2.1.8 : Fri Nov 09 2012 - 04:15:03 EET