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:
Pavel Borzenkov 2011-10-19 07:44:36 -04:00 committed by Sebastian Ramacher
parent 843a0513e2
commit 88be07272f
4 changed files with 0 additions and 20 deletions

View File

@ -211,9 +211,6 @@ zathura_db_load_bookmarks(zathura_database_t* db, const char* file)
for (gsize i = 0; i < length; i++) {
zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t));
if (bookmark == NULL) {
continue;
}
bookmark->id = g_strdup(keys[i]);
bookmark->page = g_key_file_get_integer(db->bookmarks, file, keys[i], NULL);

View File

@ -26,9 +26,6 @@ zathura_db_init(const char* dir)
}
zathura_database_t* db = g_malloc0(sizeof(zathura_database_t));
if (db == NULL) {
goto error_free;
}
/* create bookmarks database */
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) {
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->page = sqlite3_column_int(stmt, 1);

View File

@ -212,9 +212,6 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password
}
document = g_malloc0(sizeof(zathura_document_t));
if (document == NULL) {
goto error_free;
}
document->file_path = real_path;
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));
if (res == NULL) {
return NULL;
}
res->title = g_strdup(title);
return res;

View File

@ -54,10 +54,6 @@ zathura_init(int argc, char* argv[])
zathura_t* zathura = g_malloc0(sizeof(zathura_t));
if (zathura == NULL) {
return NULL;
}
/* general */
zathura->document = NULL;