From: Maxime Villard <rustyBSD@gmx.fr>

Subject: Re: [E-devel] [e] [patch] Leak (was FreeBSD patch)

I would also move some {free(x); x = null} to E_FREE.



SVN revision: 81023
This commit is contained in:
Maxime Villard 2012-12-15 14:29:38 +00:00 committed by Carsten Haitzler
parent f15a4a6f22
commit 534ae45303
1 changed files with 2 additions and 11 deletions

View File

@ -426,7 +426,6 @@ check(void)
if (fgets(buf, sizeof(buf), f) == NULL) goto error;
fclose(f);
f = NULL;
buf[sizeof(buf) - 1] = 0;
if (sscanf(buf, "%s %s %i", dummy, dummy, &temp) == 3)
ret = 1;
else
@ -444,7 +443,6 @@ check(void)
if (fgets(buf, sizeof(buf), f) == NULL) goto error;
fclose(f);
f = NULL;
buf[sizeof(buf) - 1] = 0;
if (sscanf(buf, "%i", &temp) == 1)
ret = 1;
else
@ -463,7 +461,6 @@ check(void)
if (fgets(buf, sizeof(buf), f) == NULL) goto error;
fclose(f);
f = NULL;
buf[sizeof(buf) - 1] = 0;
/* actually read the temp */
if (sscanf(buf, "%i", &temp) == 1)
ret = 1;
@ -483,7 +480,6 @@ check(void)
if (fgets(buf, sizeof(buf), f) == NULL) goto error;
fclose(f);
f = NULL;
buf[sizeof(buf) - 1] = 0;
/* actually read the temp */
if (sscanf(buf, "%i", &temp) == 1)
ret = 1;
@ -505,7 +501,6 @@ check(void)
if (fgets(buf, sizeof(buf), f) == NULL) goto error;
fclose(f);
f = NULL;
buf[sizeof(buf) - 1] = 0;
p = strchr(buf, ':');
if (p)
{
@ -531,7 +526,6 @@ check(void)
if (fgets(buf, sizeof(buf), f) == NULL) goto error;
fclose(f);
f = NULL;
buf[sizeof(buf) - 1] = 0;
temp = atoi(buf);
temp /= 1000;
ret = 1;
@ -549,12 +543,9 @@ check(void)
return -999;
error:
if (f) fclose(f);
f = NULL;
sensor_type = SENSOR_TYPE_NONE;
if (sensor_name) free(sensor_name);
sensor_name = NULL;
if (sensor_path) free(sensor_path);
sensor_path = NULL;
E_FREE(sensor_name);
E_FREE(sensor_path);
return -999;
}