Ich writing an c++ application and use ALSA for sound output.

If I run

if (snd_pcm_hw_params_any(pcm_handle, hwparams) < 0) {
        cout << "Can not configure this PCM device." << endl;
        return false;

in one method, all works fine, but if I put "snd_pcm_hw_params_alloca()" in the contructor of the class "snd_pcm_hw_params_any()" produces a Segfault. Is this a bug?