mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 22:13:48 +01:00
There is no need to check return value of g_malloc()
It never returns NULL. If this function fails, the application is terminated. Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com> Signed-off-by: Sebastian Ramacher <s.ramacher@gmx.at>
This commit is contained in:
parent
843a0513e2
commit
88be07272f
@ -211,9 +211,6 @@ zathura_db_load_bookmarks(zathura_database_t* db, const char* file)
|
|||||||
|
|
||||||
for (gsize i = 0; i < length; i++) {
|
for (gsize i = 0; i < length; i++) {
|
||||||
zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t));
|
zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t));
|
||||||
if (bookmark == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
bookmark->id = g_strdup(keys[i]);
|
bookmark->id = g_strdup(keys[i]);
|
||||||
bookmark->page = g_key_file_get_integer(db->bookmarks, file, keys[i], NULL);
|
bookmark->page = g_key_file_get_integer(db->bookmarks, file, keys[i], NULL);
|
||||||
|
@ -26,9 +26,6 @@ zathura_db_init(const char* dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
zathura_database_t* db = g_malloc0(sizeof(zathura_database_t));
|
zathura_database_t* db = g_malloc0(sizeof(zathura_database_t));
|
||||||
if (db == NULL) {
|
|
||||||
goto error_free;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create bookmarks database */
|
/* create bookmarks database */
|
||||||
static const char SQL_BOOKMARK_INIT[] =
|
static const char SQL_BOOKMARK_INIT[] =
|
||||||
@ -188,9 +185,6 @@ zathura_db_load_bookmarks(zathura_database_t* db, const char* file)
|
|||||||
|
|
||||||
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
while (sqlite3_step(stmt) == SQLITE_ROW) {
|
||||||
zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t));
|
zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t));
|
||||||
if (bookmark == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
bookmark->id = g_strdup((const char*) sqlite3_column_text(stmt, 0));
|
bookmark->id = g_strdup((const char*) sqlite3_column_text(stmt, 0));
|
||||||
bookmark->page = sqlite3_column_int(stmt, 1);
|
bookmark->page = sqlite3_column_int(stmt, 1);
|
||||||
|
@ -212,9 +212,6 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password
|
|||||||
}
|
}
|
||||||
|
|
||||||
document = g_malloc0(sizeof(zathura_document_t));
|
document = g_malloc0(sizeof(zathura_document_t));
|
||||||
if (document == NULL) {
|
|
||||||
goto error_free;
|
|
||||||
}
|
|
||||||
|
|
||||||
document->file_path = real_path;
|
document->file_path = real_path;
|
||||||
document->password = password;
|
document->password = password;
|
||||||
@ -497,10 +494,6 @@ zathura_index_element_new(const char* title)
|
|||||||
|
|
||||||
zathura_index_element_t* res = g_malloc0(sizeof(zathura_index_element_t));
|
zathura_index_element_t* res = g_malloc0(sizeof(zathura_index_element_t));
|
||||||
|
|
||||||
if (res == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
res->title = g_strdup(title);
|
res->title = g_strdup(title);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user