Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor 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
Show more breadcrumbs
schwede
openstructure
Commits
0cd48003
Commit
0cd48003
authored
6 years ago
by
Gerardo Tauriello
Browse files
Options
Downloads
Patches
Plain Diff
Fixed memory leak in CompoundLib.
parent
db786215
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/conop/src/compound_lib.cc
+9
-2
9 additions, 2 deletions
modules/conop/src/compound_lib.cc
with
9 additions
and
2 deletions
modules/conop/src/compound_lib.cc
+
9
−
2
View file @
0cd48003
...
...
@@ -361,17 +361,20 @@ CompoundLibPtr CompoundLib::Load(const String& database, bool readonly)
static_cast
<
int
>
(
aq
.
length
()),
&
stmt
,
NULL
);
lib
->
chem_type_available_
=
retval
==
SQLITE_OK
;
sqlite3_finalize
(
stmt
);
aq
=
"SELECT name FROM chem_compounds LIMIT 1"
;
retval
=
sqlite3_prepare_v2
(
lib
->
conn_
,
aq
.
c_str
(),
static_cast
<
int
>
(
aq
.
length
()),
&
stmt
,
NULL
);
lib
->
name_available_
=
retval
==
SQLITE_OK
;
sqlite3_finalize
(
stmt
);
// check if InChIs are available
aq
=
"SELECT inchi_code FROM chem_compounds LIMIT 1"
;
retval
=
sqlite3_prepare_v2
(
lib
->
conn_
,
aq
.
c_str
(),
static_cast
<
int
>
(
aq
.
length
()),
&
stmt
,
NULL
);
lib
->
inchi_available_
=
retval
==
SQLITE_OK
;
sqlite3_finalize
(
stmt
);
lib
->
creation_date_
=
lib
->
GetCreationDate
();
lib
->
ost_version_used_
=
lib
->
GetOSTVersionUsed
();
...
...
@@ -428,7 +431,7 @@ void CompoundLib::LoadBondsFromDB(CompoundPtr comp, int pk) const {
}
else
{
LOG_ERROR
(
sqlite3_errmsg
(
conn_
));
}
sqlite3_finalize
(
stmt
);
sqlite3_finalize
(
stmt
);
}
CompoundPtr
CompoundLib
::
FindCompound
(
const
String
&
id
,
...
...
@@ -522,7 +525,11 @@ CompoundLib::CompoundLib():
CompoundLib
::~
CompoundLib
()
{
if
(
conn_
)
{
sqlite3_close
(
conn_
);
int
retval
=
sqlite3_close
(
conn_
);
if
(
retval
!=
SQLITE_OK
)
{
LOG_ERROR
(
"Problem while closing SQLite db for CompoundLib: "
<<
sqlite3_errmsg
(
conn_
));
}
}
}
}}
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