Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-chain-global-db
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-chain-global-db
Commits
00b48a14
Unverified
Commit
00b48a14
authored
5 years ago
by
Dmitriy A. Gerasimov
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #7 from cellframe/feature-2313
fixed a few memory leaks
parents
0188ea0f
ac80a7f4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dap_chain_global_db_driver.c
+8
-5
8 additions, 5 deletions
dap_chain_global_db_driver.c
dap_chain_global_db_driver_sqlite.c
+1
-0
1 addition, 0 deletions
dap_chain_global_db_driver_sqlite.c
with
9 additions
and
5 deletions
dap_chain_global_db_driver.c
+
8
−
5
View file @
00b48a14
...
@@ -137,7 +137,10 @@ void dap_db_driver_deinit(void)
...
@@ -137,7 +137,10 @@ void dap_db_driver_deinit(void)
// deinit driver
// deinit driver
if
(
s_drv_callback
.
deinit
)
if
(
s_drv_callback
.
deinit
)
s_drv_callback
.
deinit
();
s_drv_callback
.
deinit
();
if
(
s_used_driver
){
DAP_DELETE
(
s_used_driver
);
s_used_driver
=
NULL
;
}
}
}
dap_store_obj_t
*
dap_store_obj_copy
(
dap_store_obj_t
*
a_store_obj
,
size_t
a_store_count
)
dap_store_obj_t
*
dap_store_obj_copy
(
dap_store_obj_t
*
a_store_obj
,
size_t
a_store_count
)
...
@@ -478,13 +481,13 @@ int dap_chain_global_db_driver_appy(pdap_store_obj_t a_store_obj, size_t a_store
...
@@ -478,13 +481,13 @@ int dap_chain_global_db_driver_appy(pdap_store_obj_t a_store_obj, size_t a_store
if
(
s_drv_callback
.
apply_store_obj
)
if
(
s_drv_callback
.
apply_store_obj
)
for
(
size_t
i
=
0
;
i
<
a_store_count
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
a_store_count
;
i
++
)
{
dap_store_obj_t
*
l_
obj
=
dap_
store_obj_c
opy
(
a_store_obj
+
i
,
1
)
;
dap_store_obj_t
*
l_store_obj_c
ur
=
a_store_obj
+
i
;
assert
(
l_
obj
);
assert
(
l_
store_obj_cur
);
if
(
!
s_drv_callback
.
apply_store_obj
(
a
_store_obj
))
{
if
(
!
s_drv_callback
.
apply_store_obj
(
l
_store_obj
_cur
))
{
//log_it(L_INFO, "Write item Ok %s/%s\n", l_obj->group, l_obj->key);
//log_it(L_INFO, "Write item Ok %s/%s\n", l_obj->group, l_obj->key);
}
}
else
{
else
{
log_it
(
L_ERROR
,
"Can't write item %s/%s
\n
"
,
l_
obj
->
group
,
l_obj
->
key
);
log_it
(
L_ERROR
,
"Can't write item %s/%s
\n
"
,
l_
store_obj_cur
->
group
,
l_store_obj_cur
->
key
);
l_ret
-=
1
;
l_ret
-=
1
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
dap_chain_global_db_driver_sqlite.c
+
1
−
0
View file @
00b48a14
...
@@ -144,6 +144,7 @@ sqlite3* dap_db_driver_sqlite_open(const char *a_filename_utf8, int a_flags, cha
...
@@ -144,6 +144,7 @@ sqlite3* dap_db_driver_sqlite_open(const char *a_filename_utf8, int a_flags, cha
int
l_rc
=
sqlite3_open_v2
(
a_filename_utf8
,
&
l_db
,
a_flags
|
SQLITE_OPEN_FULLMUTEX
,
NULL
);
int
l_rc
=
sqlite3_open_v2
(
a_filename_utf8
,
&
l_db
,
a_flags
|
SQLITE_OPEN_FULLMUTEX
,
NULL
);
// if unable to open the database file
// if unable to open the database file
if
(
l_rc
==
SQLITE_CANTOPEN
)
{
if
(
l_rc
==
SQLITE_CANTOPEN
)
{
sqlite3_close
(
l_db
);
// try to create database
// try to create database
l_rc
=
sqlite3_open_v2
(
a_filename_utf8
,
&
l_db
,
a_flags
|
SQLITE_OPEN_FULLMUTEX
|
SQLITE_OPEN_CREATE
,
NULL
);
l_rc
=
sqlite3_open_v2
(
a_filename_utf8
,
&
l_db
,
a_flags
|
SQLITE_OPEN_FULLMUTEX
|
SQLITE_OPEN_CREATE
,
NULL
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment