diff --git a/commands.c b/commands.c index 7415df3..f88fcf7 100644 --- a/commands.c +++ b/commands.c @@ -270,4 +270,3 @@ cmd_savef(girara_session_t* session, girara_list_t* argument_list) return true; } - diff --git a/completion.c b/completion.c index 9fa64a6..58534f7 100644 --- a/completion.c +++ b/completion.c @@ -154,6 +154,10 @@ cc_bookmarks(girara_session_t* session, const char* input) girara_completion_t* completion = girara_completion_init(); girara_completion_group_t* group = girara_completion_group_create(session, NULL); + if (completion == NULL || group == NULL) { + goto error_free; + } + const size_t input_length = input ? strlen(input) : 0; GIRARA_LIST_FOREACH(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark) @@ -164,5 +168,19 @@ cc_bookmarks(girara_session_t* session, const char* input) } GIRARA_LIST_FOREACH_END(zathura->bookmarks.bookmarks, zathura_bookmark_t*, iter, bookmark) + girara_completion_add_group(completion, group); + return completion; + +error_free: + + if (completion) { + girara_completion_free(completion); + } + + if (group) { + girara_completion_group_free(group); + } + + return NULL; }