[PATCH] lib: fwts_battery: fix no fclose() after fopen is called.

Alex Hung alex.hung at canonical.com
Tue May 22 09:03:19 UTC 2012


Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
 src/lib/src/fwts_battery.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lib/src/fwts_battery.c b/src/lib/src/fwts_battery.c
index d8cc318..5f21dfa 100644
--- a/src/lib/src/fwts_battery.c
+++ b/src/lib/src/fwts_battery.c
@@ -101,6 +101,7 @@ static int fwts_battery_get_capacity_sys_fs(fwts_framework *fw,
 						(*count)++;
 					}
 				}
+				fclose(fp);
 			}
 		}
 	} while (entry);
@@ -167,6 +168,7 @@ static int fwts_battery_get_capacity_proc_fs(fwts_framework *fw,
 						break;
 					}
 				}
+				fclose(fp);
 			}
 		}
 	} while (entry);
@@ -307,6 +309,7 @@ static int fwts_battery_get_cycle_count_sys_fs(fwts_framework *fw, DIR *dir, int
 						*cycle_count = val;
 					}
 				}
+				fclose(fp);
 			}
 		}
 	} while (entry);
@@ -350,6 +353,7 @@ static int fwts_battery_get_cycle_count_proc_fs(fwts_framework *fw, DIR *dir, in
 						break;
 					}
 				}
+				fclose(fp);
 			}
 		}
 	} while (entry);
-- 
1.7.9.5





More information about the fwts-devel mailing list