Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
5c209f7d
Commit
5c209f7d
authored
Feb 09, 2012
by
Robert Menzel
Browse files
fixed a bug in the memory allocation
parent
0469d2c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ACGL/Base/FileOperations.cc
View file @
5c209f7d
...
...
@@ -30,11 +30,15 @@ bool FileOperations::rawData(const std::string& _filename, char*& _pData, long_t
_size
=
ftell
(
pFile
);
rewind
(
pFile
);
// allocate memory to contain the whole file:
_pData
=
new
char
[
sizeof
(
char
)
*
_size
];
if
(
_pData
==
NULL
)
try
{
// allocate memory to contain the whole file:
_pData
=
new
char
[
_size
];
}
catch
(...)
{
error
()
<<
"Memory error!"
<<
std
::
endl
;
fclose
(
pFile
);
return
false
;
}
...
...
@@ -43,6 +47,7 @@ bool FileOperations::rawData(const std::string& _filename, char*& _pData, long_t
if
(
(
long_t
)
result
!=
_size
)
{
error
()
<<
"Reading error!"
<<
std
::
endl
;
fclose
(
pFile
);
return
false
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment