diff --git a/agent.c b/agent.c index 659e0c10..73abffd7 100644 --- a/agent.c +++ b/agent.c @@ -133,7 +133,6 @@ static int agent_socket_get_cred(int fd, struct ucred *cred) static void agent_run(unsigned const char key[KDF_HASH_LEN]) { - _cleanup_free_ char *path; char *agent_timeout_str; unsigned int agent_timeout; struct sockaddr_un sa, listensa; @@ -153,7 +152,7 @@ static void agent_run(unsigned const char key[KDF_HASH_LEN]) if (agent_timeout) alarm(agent_timeout); - path = agent_socket_path(); + _cleanup_free_ char *path = agent_socket_path(); if (strlen(path) >= sizeof(sa.sun_path)) die("Path too large for agent control socket."); @@ -200,12 +199,11 @@ static void agent_run(unsigned const char key[KDF_HASH_LEN]) void agent_kill(void) { - _cleanup_free_ char *path; struct sockaddr_un sa; struct ucred cred; int fd; - path = agent_socket_path(); + _cleanup_free_ char *path = agent_socket_path(); if (strlen(path) >= sizeof(sa.sun_path)) die("Path too large for agent control socket."); @@ -235,12 +233,11 @@ void agent_kill(void) static bool agent_ask(unsigned char key[KDF_HASH_LEN]) { - _cleanup_free_ char *path; struct sockaddr_un sa; int fd; bool ret = false; - path = agent_socket_path(); + _cleanup_free_ char *path = agent_socket_path(); if (strlen(path) >= sizeof(sa.sun_path)) die("Path too large for agent control socket."); diff --git a/blob.c b/blob.c index 4cddc0dc..86cde182 100644 --- a/blob.c +++ b/blob.c @@ -612,12 +612,11 @@ size_t blob_write(const struct blob *blob, const unsigned char key[KDF_HASH_LEN] { struct buffer buffer; struct share *last_share = NULL; - _cleanup_free_ char *version; struct account *account; memset(&buffer, 0, sizeof(buffer)); - version = xultostr(blob->version); + _cleanup_free_ char *version = xultostr(blob->version); buffer_append(&buffer, "LPAV", 4); write_plain_string(&buffer, version); buffer_append(&buffer, "LOCL", 4); diff --git a/cmd-ls.c b/cmd-ls.c index 6279a033..970e5e00 100644 --- a/cmd-ls.c +++ b/cmd-ls.c @@ -131,11 +131,9 @@ static void print_node(struct node *head, int level) printf(" "); if (node->account) { if (long_listing) { - _cleanup_free_ char *timestr; - if (show_mtime) - timestr = format_timestamp(node->account->last_modified_gmt, true); - else - timestr = format_timestamp(node->account->last_touch, false); + _cleanup_free_ char *timestr = show_mtime ? + format_timestamp(node->account->last_modified_gmt, true) : + format_timestamp(node->account->last_touch, false); terminal_printf(TERMINAL_FG_CYAN "%s ", timestr); } terminal_printf(TERMINAL_FG_GREEN TERMINAL_BOLD "%s" TERMINAL_NO_BOLD " [id: %s]" TERMINAL_RESET "\n", node->name, node->account->id); @@ -246,11 +244,9 @@ int cmd_ls(int argc, char **argv) insert_node(root, fullname, account); else { if (long_listing) { - _cleanup_free_ char *timestr; - if (show_mtime) - timestr = format_timestamp(account->last_modified_gmt, true); - else - timestr = format_timestamp(account->last_touch, false); + _cleanup_free_ char *timestr = show_mtime ? + format_timestamp(account->last_modified_gmt, true) : + format_timestamp(account->last_touch, false); printf("%s ", timestr); } printf("%s [id: %s]\n", fullname, account->id); diff --git a/endpoints.c b/endpoints.c index 19c22e0c..53cb8818 100644 --- a/endpoints.c +++ b/endpoints.c @@ -65,9 +65,8 @@ void lastpass_logout(const struct session *session) struct blob *lastpass_get_blob(const struct session *session, const unsigned char key[KDF_HASH_LEN]) { size_t len; - _cleanup_free_ char *blob; - blob = http_post_lastpass("getaccts.php", session->sessionid, &len, "mobile", "1", "requestsrc", "cli", "hasplugin", LASTPASS_CLI_VERSION, NULL); + _cleanup_free_ char *blob = http_post_lastpass("getaccts.php", session->sessionid, &len, "mobile", "1", "requestsrc", "cli", "hasplugin", LASTPASS_CLI_VERSION, NULL); if (!blob || !len) return NULL; config_write_encrypted_buffer("blob", blob, len, key); diff --git a/lpass.c b/lpass.c index e6db7e66..d202a98e 100644 --- a/lpass.c +++ b/lpass.c @@ -112,11 +112,10 @@ static void expand_aliases(int *argc, char ***argv) int argv_alloced; int new_argc = 0; _cleanup_free_ char *config_name; - _cleanup_free_ char *alias_val; xasprintf(&config_name, "alias.%s", alias); - alias_val = config_read_string(config_name); + _cleanup_free_ char *alias_val = config_read_string(config_name); if (!alias_val) return;