forked from enlightenment/efl
The comment does say "Allocate struct for eet file and have it zero'd
out" but using calloc is inefficient since most members of the struct are written to straight away. Valgrind complains that the data member can sometimes be used without being initialised. Seems to happen when we can't open it and eet_close tests the value of the data member. Those that know this code better than me should check this. Probably a good idea to initialise ALL members at this point. SVN revision: 24848
This commit is contained in:
parent
ed7d138bbc
commit
35d34dee92
|
@ -536,6 +536,8 @@ eet_open(const char *file, Eet_File_Mode mode)
|
||||||
ef->header = NULL;
|
ef->header = NULL;
|
||||||
ef->mtime = file_stat.st_mtime;
|
ef->mtime = file_stat.st_mtime;
|
||||||
ef->delete_me_now = 0;
|
ef->delete_me_now = 0;
|
||||||
|
ef->data = NULL;
|
||||||
|
ef->data_size = 0;
|
||||||
|
|
||||||
/* try open the file based on mode */
|
/* try open the file based on mode */
|
||||||
if ((ef->mode == EET_FILE_MODE_READ) || (ef->mode == EET_FILE_MODE_READ_WRITE))
|
if ((ef->mode == EET_FILE_MODE_READ) || (ef->mode == EET_FILE_MODE_READ_WRITE))
|
||||||
|
@ -556,9 +558,6 @@ eet_open(const char *file, Eet_File_Mode mode)
|
||||||
if (eet_test_close(!ef->fp, ef))
|
if (eet_test_close(!ef->fp, ef))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ef->data = NULL;
|
|
||||||
ef->data_size = 0;
|
|
||||||
|
|
||||||
fcntl(fileno(ef->fp), F_SETFD, FD_CLOEXEC);
|
fcntl(fileno(ef->fp), F_SETFD, FD_CLOEXEC);
|
||||||
/* if we opened for read or read-write */
|
/* if we opened for read or read-write */
|
||||||
if ((mode == EET_FILE_MODE_READ) || (mode == EET_FILE_MODE_READ_WRITE))
|
if ((mode == EET_FILE_MODE_READ) || (mode == EET_FILE_MODE_READ_WRITE))
|
||||||
|
|
Loading…
Reference in New Issue