summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2023-07-04 13:10:12 -0700
committerLouie S <louie@example.com>2023-07-04 13:10:12 -0700
commit27f266e072ad40cdb9c46190b1d8ccc212af001e (patch)
tree2dcecbfb73cfefaad3f72320107d516873d2b2e0 /src
parenta3998565d27e5ce835d521dd58a9c30ff2fd83ed (diff)
Fix memory leak
Diffstat (limited to 'src')
-rw-r--r--src/db/sqlite3/db.c4
-rw-r--r--src/draw.c2
2 files changed, 2 insertions, 4 deletions
diff --git a/src/db/sqlite3/db.c b/src/db/sqlite3/db.c
index 796d924..f863028 100644
--- a/src/db/sqlite3/db.c
+++ b/src/db/sqlite3/db.c
@@ -171,14 +171,14 @@ int create_tables(const char *path) {
// callback functions
int group_count_callback(void *first_arg, int argc, char **argv, char **azColName) {
Group **groups = (Group **) first_arg;
- *groups = malloc(sizeof(Group) * argc);
+ *groups = malloc(sizeof(Group) * atoi(argv[0]));
return 0;
}
int entry_count_callback(void *first_arg, int argc, char **argv, char **azColName) {
Entry **entries = (Entry **) first_arg;
- *entries = malloc(sizeof(Entry) * argc);
+ *entries = malloc(sizeof(Entry) * atoi(argv[0]));
return 0;
}
diff --git a/src/draw.c b/src/draw.c
index 04e02e2..57e0021 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -24,8 +24,6 @@ void tui_init(Group **groups, Entry **entries) {
wrefresh(w_main);
// draw groups and entries
- fprintf(stderr, "groups: %d\n", sizeof(*groups) / sizeof(Group));
- fprintf(stderr, "entries: %d\n", sizeof(*entries) / sizeof(Entry));
input = getch();
tui_end();