[PATCH skeleton v6 07/20] fix info memory leak
Stewart Smith
stewart at linux.vnet.ibm.com
Thu Apr 21 03:20:25 AEST 2016
OpenBMC Patches <openbmc-patches at stwcx.xyz> writes:
> From: Ken <ken1029 at gmail.com>
>
> ---
[ 35 more citation lines. Click/Enter to show. ]
> objects/info.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/objects/info.c b/objects/info.c
> index ab2d98c..d872c3f 100644
> --- a/objects/info.c
> +++ b/objects/info.c
> @@ -42,6 +42,7 @@ static int i2c_open() {
> fd = open(fn, O_RDWR);
> if (fd == -1) {
> LOG_ERR(errno, "Failed to open i2c device %s", fn);
> + close(fd);
> return -1;
> }
>
> @@ -108,6 +109,7 @@ static int i2c_io(int fd) {
> rc = ioctl(fd, I2C_RDWR, &data);
> if (rc < 0) {
> LOG_ERR(errno, "Failed to do raw io");
> + close(fd);
> return -1;
> }
>
> @@ -126,6 +128,7 @@ int get_hdd_status(void)
> }
>
> if (i2c_io(fd) < 0) {
> + close(fd);
> return -1;
> }
>
> @@ -145,7 +148,7 @@ int get_hdd_status(void)
>
> g_read_tmp[2]=g_read_bytes[2];
> g_read_tmp[3]=g_read_bytes[3];
> -
> + close(fd);
> }
Please fold into patch that introduced the code.
--
Stewart Smith
OPAL Architect, IBM.
More information about the openbmc
mailing list