aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-07-12 21:12:26 +0000
committerFranklin Wei <me@fwei.tk>2018-07-12 21:12:26 +0000
commit883824b8710d52ffbc0bc28bacfbac72f7443064 (patch)
tree78f161f8420cb7389aaa74237972f20d09e6d8a7
parent0c68f9899f91e15e5aa999ae98635429a6606870 (diff)
downloadcsaa-883824b8710d52ffbc0bc28bacfbac72f7443064.zip
csaa-883824b8710d52ffbc0bc28bacfbac72f7443064.tar.gz
csaa-883824b8710d52ffbc0bc28bacfbac72f7443064.tar.bz2
csaa-883824b8710d52ffbc0bc28bacfbac72f7443064.tar.xz
Fix memory leak in find_empty_slot()
Wasn't freeing statement before. Impact should be minimal.
-rw-r--r--service_provider.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/service_provider.c b/service_provider.c
index 9445b8a..77edb2a 100644
--- a/service_provider.c
+++ b/service_provider.c
@@ -709,12 +709,14 @@ static uint64_t find_empty_slot(struct service_provider *sp)
int rc = sqlite3_step(st);
+ uint64_t slot = (uint64_t) -1;
+
if(rc == SQLITE_ROW)
- {
- return sqlite3_column_int64(st, 0);
- }
+ slot = sqlite3_column_int64(st, 0);
+
+ sqlite3_finalize(st);
- return (uint64_t) -1;
+ return slot;
}
struct tm_request sp_createfile(struct service_provider *sp,