Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
blaar
blibs
blc_core
Commits
af871b3f
Commit
af871b3f
authored
Jul 11, 2017
by
Arnaud Blanchard
Browse files
Allocate(0) id a free with blc_mem
parent
5b38088b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/blc_mem.cpp
View file @
af871b3f
...
...
@@ -38,10 +38,12 @@ void blc_mem::allocate(){
}
void
blc_mem
::
allocate
(
size_t
new_size
){
if
(
new_size
!=
size
||
data
==
NULL
)
// Changement de taille ou l'allocation n'a encore jamais été faite
{
free
(
data
);
data
=
MANY_ALLOCATIONS
(
new_size
,
char
);
if
(
data
)
free
(
data
);
if
(
new_size
)
data
=
MANY_ALLOCATIONS
(
new_size
,
char
);
else
data
=
NULL
;
size
=
new_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