[Olsr-cvs] olsrd-current/src/linux apm.c,1.15,1.16
Bernd Petrovitsch
(spam-protected)
Sun Nov 26 01:32:16 CET 2006
Update of /cvsroot/olsrd/olsrd-current/src/linux
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29341/src/linux
Modified Files:
apm.c
Log Message:
* Fixed a leaking FILE *
* Since the "buffer" variable can never be == NULL, I assume that it was meant actually that way.
Index: apm.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/linux/apm.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** apm.c 26 Oct 2006 22:02:56 -0000 1.15
--- apm.c 26 Nov 2006 00:32:14 -0000 1.16
***************
*** 191,203 ****
return 0;
!
! fgets(buffer, sizeof(buffer) - 1, apm_procfile);
! if(buffer == NULL)
{
/* Try re-opening the file */
if((apm_procfile = fopen(APM_PROC, "r")) != NULL)
return 0;
! fgets(buffer, sizeof(buffer) - 1, apm_procfile);
! if(buffer == NULL)
{
/* Giving up */
--- 191,202 ----
return 0;
! if(fgets(buffer, sizeof(buffer) - 1, apm_procfile) == NULL)
{
+ fclose(apm_procfile);
/* Try re-opening the file */
if((apm_procfile = fopen(APM_PROC, "r")) != NULL)
return 0;
!
! if(fgets(buffer, sizeof(buffer) - 1, apm_procfile) == NULL)
{
/* Giving up */
More information about the Olsr-cvs
mailing list