Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 8d0f7463 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

BASE: Fix some leaks found by valgrind.

It seems that there are some leaks in libass, can't fix those...
parent fb9bdac5
Branches
Étiquettes
1 requête de fusion!153Fix some memory leaks
Pipeline #2149 réussi avec des avertissements
......@@ -51,11 +51,12 @@ stack_push(struct stack *lst, void *item)
return 1;
if (lst->size == lst->len) {
volatile void **new = realloc(lst->contents,
lst->size * 2 * sizeof(void *));
volatile void **new = realloc(lst->contents, lst->size * 2 * sizeof(void *));
if (NULL == new)
return 1;
if (NULL == new) {
LOG_ERROR("GENERAL", "Out of memory");
abort();
}
lst->contents = new;
lst->size *= 2;
......
......@@ -74,12 +74,10 @@ __inc(volatile sqlite3 *db, const char *name, bool check)
exit(EXIT_FAILURE);
}
struct named_db *item = malloc(sizeof(struct named_db));
if (!item)
exit(EXIT_FAILURE);
item->name = strdup(name);
item->db = db;
if (stack_push(&db_stack, item))
struct named_db item;
item.name = strdup(name);
item.db = db;
if (stack_push(&db_stack, &item))
exit(EXIT_FAILURE);
return;
error:
......@@ -161,10 +159,14 @@ __check_schema(volatile sqlite3 *db)
sqlite3_stmt *stmt = NULL;
SQLITE_PREPARE(db, stmt, SQL, error);
SQLITE_STEP_ROW(db, stmt, error);
if (9 != sqlite3_column_int(stmt, 0))
if (9 != sqlite3_column_int(stmt, 0)) {
sqlite3_finalize(stmt);
return true;
}
error:
LOG_ERROR("DB", "Schema is invalid: missing tables");
if (stmt)
sqlite3_finalize(stmt);
return false;
}
......@@ -173,7 +175,7 @@ __is_attached(volatile sqlite3 *db, const char *name)
{
static const char *SQL_STMT =
"SELECT name FROM pragma_database_list WHERE name = ?;\n";
sqlite3_stmt *stmt = 0;
sqlite3_stmt *stmt = NULL;
bool ret = false;
SQLITE_PREPARE(db, stmt, SQL_STMT, error);
......
......@@ -143,6 +143,9 @@ launch_klkt(va_list UNUSED *___args)
static const char *basename_appimage_arch = "klkt.AppImage";
static const char *basename_appimage_no_arch = "klkt-" LKT_ARCH ".AppImage";
memset(exe_path, 0, sizeof(exe_path));
memset(try_name, 0, sizeof(try_name));
posix_spawn_file_actions_t action;
posix_spawn_file_actions_init(&action);
posix_spawn_file_actions_addopen(&action, STDOUT_FILENO, "/dev/null", O_RDONLY, 0);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter