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

Colin Ian King colin.king at canonical.com
Tue May 22 20:19:18 UTC 2012


Well spotted, this originated from my lame code. I will check if I've 
done this in other places too.

Colin

On 22/05/12 10:03, Alex Hung wrote:
> 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);
>






More information about the fwts-devel mailing list