Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
5c47e2e9
Unverified
Commit
5c47e2e9
authored
Mar 21, 2019
by
Salvatore Sanfilippo
Committed by
GitHub
Mar 21, 2019
Browse files
Merge pull request #4696 from oranagra/zrealloc_fix
Fix zrealloc to behave similarly to je_realloc when size is 0
parents
5c21eca6
5def6500
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/zmalloc.c
View file @
5c47e2e9
...
@@ -148,6 +148,10 @@ void *zrealloc(void *ptr, size_t size) {
...
@@ -148,6 +148,10 @@ void *zrealloc(void *ptr, size_t size) {
size_t
oldsize
;
size_t
oldsize
;
void
*
newptr
;
void
*
newptr
;
if
(
size
==
0
&&
ptr
!=
NULL
)
{
zfree
(
ptr
);
return
NULL
;
}
if
(
ptr
==
NULL
)
return
zmalloc
(
size
);
if
(
ptr
==
NULL
)
return
zmalloc
(
size
);
#ifdef HAVE_MALLOC_SIZE
#ifdef HAVE_MALLOC_SIZE
oldsize
=
zmalloc_size
(
ptr
);
oldsize
=
zmalloc_size
(
ptr
);
...
...
Write
Preview
Markdown
is supported
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