Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLASfpga
VILLASfpga
Commits
d3a58196
Commit
d3a58196
authored
Jul 20, 2018
by
Daniel Krebs
Browse files
villas/memory: add sanity check to deny allocating zero-sized memory
parent
26d7a13e
Pipeline
#64229
failed with stages
in 1 minute and 11 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
include/villas/memory.hpp
View file @
d3a58196
...
...
@@ -136,6 +136,12 @@ public:
MemoryAccessor
<
T
>
allocate
(
size_t
num
)
{
if
(
num
==
0
)
{
// doesn't make sense to allocate an empty block
logger
->
error
(
"Trying to allocate empty memory"
);
throw
std
::
bad_alloc
();
}
const
size_t
size
=
num
*
sizeof
(
T
);
auto
mem
=
allocateBlock
(
size
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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