Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
30606486
Commit
30606486
authored
Jun 16, 2004
by
marko@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InnoDB bug fix: mem_realloc() didn't preserve the block contents
parent
d2724e66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
innobase/include/mem0mem.ic
innobase/include/mem0mem.ic
+15
-3
No files found.
innobase/include/mem0mem.ic
View file @
30606486
...
...
@@ -575,9 +575,21 @@ mem_realloc(
char* file_name,/* in: file name where called */
ulint line) /* in: line where called */
{
mem_free(buf);
return(mem_alloc_func(n, file_name, line));
mem_heap_t* heap = (mem_heap_t*)((byte*)buf
- MEM_BLOCK_HEADER_SIZE - MEM_FIELD_HEADER_SIZE);
ulint size;
ut_a(heap->magic_n == MEM_BLOCK_MAGIC_N);
size = mem_block_get_len(heap);
ut_a(size > MEM_BLOCK_HEADER_SIZE + MEM_FIELD_HEADER_SIZE);
size -= MEM_BLOCK_HEADER_SIZE + MEM_FIELD_HEADER_SIZE;
if (n > size) {
void* newbuf = memcpy(mem_alloc_func(n, file_name, line),
buf, size);
mem_free(buf);
buf = newbuf;
}
return(buf);
}
/**************************************************************************
...
...
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