the correct way to free is free_the_label(&label) > Hello Frodo Looijaard, > > I am a german student and currently writing a small graphical frontend for= > lm=5Fsensors. > Everything works as I wish, but I encountered a small memory leak that has= > to do with the=20 > "sensors=5Fget=5Flabel"-function of libsensors. > I asked in several diskussion boards in the net, but nobody could help me.= > > (If I ask the wrong person, or if you don't find the time to help/answer, = > I would be pleased if you could tell me=20 > who I could ask). > > One function, I wrote, uses the following commands: > > int i=3D0, nr1=3D0, nr2=3D0; > const sensors=5Fchip=5Fname * sensors=5Fchip; > const sensors=5Ffeature=5Fdata * sensor=5Fdata; > > sensors=5Fchip =3D sensors=5Fget=5Fdetected=5Fchips( &i)) > sensor=5Fdata =3D sensors=5Fget=5Fall=5Ffeatures( *sensors=5Fchip, &nr1, &nr2)) > char * label; > > sensors=5Fget=5Flabel ( *sensors=5Fchip, sensor=5Fdata->number, &label); > > The last of the seven lines is called periodically ( eg. all 3 seconds). > This causes a leak of 4 bytes about every 10 seconds (more or less). > Four byte ist not much, but unacceptable. > I am sure that the sensors=5Fget=5Flabel-command is "guilty", because if I com= > ment this line ( using //) I can run=20 > my program for hours without "loosing" this four bytes periodically. > > So I added the following line as adviced in your sensors.h (quote: "*resul= > t is newly allocated (free it=20 > yourself)"). > > free( label); > > But this did not change anything. The memory leak did not vanish. > > I hope this is enough information so that you (or someone else) can help m= > e.=20 > How can I get rid of this memory leak=3F > > Yours sincerely, > > Michael Zwick > > =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= > =5F=5F=5F=5F > Die clevere Geldreserve: der DiBa-Privatkredit. Funktioniert wie ein Dispo= > ,=20 > ist aber viel g=FCnstiger! Alle Infos: http://diba.web.de/=3Fmc=3D021104 > > -- > Frodo Looijaard <frodol at dds.nl> PGP key and more: http://huizen.dds.nl/~frodol > Defenestration n. (formal or joc.): > The act of removing Windows from your computer in disgust, usually followed > by the installation of Linux or some other Unix-like operating system.