[LAD] c/jack question

Mark McCurry mark.d.mccurry at gmail.com
Sun Apr 8 16:49:40 UTC 2012


> Pardon the newb question, but why does: ...
This is a fairly simple C mistake.
In A, &pos refers to valid chunk of memory, thus when
jack_transport_query operates on it, it has a valid piece of memory to
work with.
In B, pos (IIRC) would be initialized to NULL as it is in the file scope.
So when you call jack_transport_query, you have provided a pointer to
NULL, where any memory access will be invalid.

If you set pos in B to be a pointer to a valid object (chunk of
memory) then it should work fine (ie refer to a global object or an
object allocated on the heap with malloc or friends).

--Mark



More information about the Linux-audio-dev mailing list