edje: free allocated memory in epp

Summary: fname variable's memory is allocated but not freed.

Reviewers: cedric, seoz, woohyun, Hermet

Reviewed By: Hermet

Differential Revision: https://phab.enlightenment.org/D1785
This commit is contained in:
Thiep Ha 2014-12-18 09:05:50 +09:00 committed by ChunEon Park
parent 63abe9b00c
commit 6d0b834a76
1 changed files with 18 additions and 4 deletions

View File

@ -3325,13 +3325,19 @@ do_include(cpp_reader * pfile, struct directive *keyword,
strncpy(fname, (const char *)fbeg, flen); strncpy(fname, (const char *)fbeg, flen);
fname[flen] = 0; fname[flen] = 0;
if (redundant_include_p(pfile, fname)) if (redundant_include_p(pfile, fname))
return 0; {
free(fname);
return 0;
}
if (importing) if (importing)
f = lookup_import(pfile, fname, NULL); f = lookup_import(pfile, fname, NULL);
else else
f = open_include_file(pfile, fname, NULL); f = open_include_file(pfile, fname, NULL);
if (f == -2) if (f == -2)
return 0; /* Already included this file */ {
free(fname);
return 0; /* Already included this file */
}
} }
else else
{ {
@ -3380,13 +3386,19 @@ do_include(cpp_reader * pfile, struct directive *keyword,
* of redundant include files: #import, #pragma once, and * of redundant include files: #import, #pragma once, and
* redundant_include_p. It would be nice if they were unified. */ * redundant_include_p. It would be nice if they were unified. */
if (redundant_include_p(pfile, fname)) if (redundant_include_p(pfile, fname))
return 0; {
free(fname);
return 0;
}
if (importing) if (importing)
f = lookup_import(pfile, fname, searchptr); f = lookup_import(pfile, fname, searchptr);
else else
f = open_include_file(pfile, fname, searchptr); f = open_include_file(pfile, fname, searchptr);
if (f == -2) if (f == -2)
return 0; /* Already included this file */ {
free(fname);
return 0; /* Already included this file */
}
#ifdef EACCES #ifdef EACCES
else if (f == -1 && errno == EACCES) else if (f == -1 && errno == EACCES)
cpp_warning(pfile, "Header file %s exists, but is not readable", cpp_warning(pfile, "Header file %s exists, but is not readable",
@ -3467,6 +3479,7 @@ do_include(cpp_reader * pfile, struct directive *keyword,
if (!strcmp(ptr->fname, fname)) if (!strcmp(ptr->fname, fname))
{ {
close(f); close(f);
free(fname);
return 0; /* This file was once'd. */ return 0; /* This file was once'd. */
} }
} }
@ -3524,6 +3537,7 @@ do_include(cpp_reader * pfile, struct directive *keyword,
if (angle_brackets) if (angle_brackets)
pfile->system_include_depth--; pfile->system_include_depth--;
} }
free(fname);
return 0; return 0;
} }