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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
8314b2c9
Commit
8314b2c9
authored
Jan 30, 2008
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't double free. Addresses #322.
git-svn-id:
file:///svn/tokudb@1964
c7de825b-a66e-492c-adef-691d508d4ae1
parent
4d17c725
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/tests/Makefile
src/tests/Makefile
+2
-0
src/tests/test_db_donotindex.c
src/tests/test_db_donotindex.c
+4
-6
No files found.
src/tests/Makefile
View file @
8314b2c9
...
...
@@ -149,6 +149,8 @@ NO_VGRIND = \
dup_dup
\
dup_flags
\
dup_insert
\
dup_next
\
dup_search
\
log4
\
log5
\
# Comment to terminate list so the previous line can end with a slash
...
...
src/tests/test_db_donotindex.c
View file @
8314b2c9
...
...
@@ -26,8 +26,6 @@ DB_TXN *const null_txn = 0;
DB_ENV
*
dbenv
=
0
;
void
*
lastmalloced
=
NULL
;
/*
* getname -- extracts a secondary key (the last name) from a primary
* key/data pair
...
...
@@ -57,8 +55,8 @@ int getskey(DB *secondary, const DBT *pkey, const DBT *pdata, DBT *skey)
if
(
callback_init_data
)
{
skey
->
size
=
sizeof
(
entry
->
skey
);
if
(
callback_set_malloc
)
{
skey
->
data
=
lastmalloced
=
malloc
(
skey
->
size
);
memcpy
(
skey
->
data
,
&
entry
->
skey
,
skey
->
size
);
skey
->
data
=
malloc
(
skey
->
size
);
memcpy
(
skey
->
data
,
&
entry
->
skey
,
skey
->
size
);
}
else
skey
->
data
=
&
entry
->
skey
;
}
...
...
@@ -135,10 +133,10 @@ int main(int argc, const char *argv[]) {
callback_set_malloc
=
i
&
(
1
<<
1
);
callback_return_DONOTINDEX
=
i
&
(
1
<<
2
);
lastmalloced
=
NULL
;
insert
();
check_secondary
(
callback_return_DONOTINDEX
?
DB_NOTFOUND
:
0
);
if
(
callback_return_DONOTINDEX
)
free
(
lastmalloced
);
// For recent versions of BDB, we don't need to free any malloced object, even if it we returned DB_DONOTINDEX because if we malloced it then we set DB_DBT_APPMALLOC
// Older versions of BDB didn't free it. Which versions did?
close_dbs
();
}
return
0
;
...
...
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