I wrote some code with portaudio and tested it with Valgrind. As a result, I got "0 bytes definitely lost". But, when I mixed it with the glut (freeglut) library to include graphics, I got "24 bytes definitely lost".
In the code below I simply added glutCreateWindow( "OpenGL" ) and then I got the memory leak in Valgrind's report. I'm using glew, freeglut, portaudio, sndfile libraries. Does any know what is happening here?
#include "util.h"
#include "sound.h"
#include <unistd.h>
/*Funcion main para creacion de hilos de reproduccion*/
int main(int argc, char* args[]){
sound::loadStream("../pacman.wav");// this function do Pa_Initiliaze()/Pa_OpenDefaultStream()/
//Pa_StartStream()/
sound::loadStream("../ya_te.wav");
glutInit( &argc, args );
//Create OpenGL 2.1 context
glutInitContextVersion( 2, 1 );
//Create Double Buffered and RGBA Window
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH );
glutInitWindowSize( 1920, 1080 ); //size of window
glutCreateWindow( "OpenGL" ); // leak memory start at this line
sound::changeState(0,PLAY); //this fucntion change pacman.wav state to PLAY in portaudio
//callback
sound::changeState(1,PLAY); // this function change ya_te.wav state to PLAY in portaudio
//callback
sleep(1); // sleep for 1 second
sound::soundTerminate(); // this function do Pa_closeStream , Pa_terminate();
glutDestroyWindow(glutGetWindow());
return 0;
}