Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From a3353429652f83bb8b0316500faa88fa2555542d Mon Sep 17 00:00:00 2001 |
| 2 | From: Peter Marko <peter.marko@siemens.com> |
| 3 | Date: Thu, 13 Apr 2017 23:09:52 +0200 |
| 4 | Subject: [PATCH] Fix freeing memory allocated by sqlite |
| 5 | |
| 6 | Upstream-Status: Backport |
| 7 | Signed-off-by: Peter Marko <peter.marko@siemens.com> |
| 8 | --- |
| 9 | src/core.c | 8 ++++---- |
| 10 | 1 file changed, 4 insertions(+), 4 deletions(-) |
| 11 | |
| 12 | diff --git a/src/core.c b/src/core.c |
| 13 | index 6263031..6788f16 100644 |
| 14 | --- a/src/core.c |
| 15 | +++ b/src/core.c |
| 16 | @@ -82,7 +82,7 @@ static bool ensure_table(CveDB *self) |
| 17 | rc = sqlite3_exec(self->db, query, NULL, NULL, &err); |
| 18 | if (rc != SQLITE_OK) { |
| 19 | fprintf(stderr, "ensure_table(): %s\n", err); |
| 20 | - free(err); |
| 21 | + sqlite3_free(err); |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | @@ -91,7 +91,7 @@ static bool ensure_table(CveDB *self) |
| 26 | rc = sqlite3_exec(self->db, query, NULL, NULL, &err); |
| 27 | if (rc != SQLITE_OK) { |
| 28 | fprintf(stderr, "ensure_table(): %s\n", err); |
| 29 | - free(err); |
| 30 | + sqlite3_free(err); |
| 31 | return false; |
| 32 | } |
| 33 | |
| 34 | @@ -99,11 +99,11 @@ static bool ensure_table(CveDB *self) |
| 35 | rc = sqlite3_exec(self->db, query, NULL, NULL, &err); |
| 36 | if (rc != SQLITE_OK) { |
| 37 | fprintf(stderr, "ensure_table(): %s\n", err); |
| 38 | - free(err); |
| 39 | + sqlite3_free(err); |
| 40 | return false; |
| 41 | } |
| 42 | if (err) { |
| 43 | - free(err); |
| 44 | + sqlite3_free(err); |
| 45 | } |
| 46 | |
| 47 | return true; |
| 48 | -- |
| 49 | 2.1.4 |
| 50 | |