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

Jacob jacob01 at gmx.net
Fri Nov 9 00:58:07 UTC 2012


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




More information about the Linux-audio-dev mailing list