don't free an array on the stack
[gregoa/bti.git] / bti.c
diff --git a/bti.c b/bti.c
index 259063c..02332c4 100644 (file)
--- a/bti.c
+++ b/bti.c
@@ -356,7 +356,7 @@ static int send_request(struct session *session)
                curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
                slist = curl_slist_append(slist, "Expect:");
                curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
-               
+
                sprintf(endpoint, "%s%s", session->hosturl, update_uri);
                curl_easy_setopt(curl, CURLOPT_URL, endpoint);
                curl_easy_setopt(curl, CURLOPT_USERPWD, user_password);
@@ -372,21 +372,23 @@ static int send_request(struct session *session)
 
                break;
        case ACTION_USER:
-               sprintf(endpoint, "%s%s%s.xml?page=%d", session->hosturl, user_uri,
-                               session->user, session->page);
+               sprintf(endpoint, "%s%s%s.xml?page=%d", session->hosturl,
+                       user_uri, session->user, session->page);
                curl_easy_setopt(curl, CURLOPT_URL, endpoint);
 
                break;
        case ACTION_REPLIES:
                snprintf(user_password, sizeof(user_password), "%s:%s",
                         session->account, session->password);
-               sprintf(endpoint, "%s%s?page=%d", session->hosturl, replies_uri, session->page);
+               sprintf(endpoint, "%s%s?page=%d", session->hosturl, replies_uri,
+                       session->page);
                curl_easy_setopt(curl, CURLOPT_URL, endpoint);
                curl_easy_setopt(curl, CURLOPT_USERPWD, user_password);
 
                break;
        case ACTION_PUBLIC:
-               sprintf(endpoint, "%s%s?page=%d", session->hosturl, public_uri, session->page);
+               sprintf(endpoint, "%s%s?page=%d", session->hosturl, public_uri,
+                       session->page);
                curl_easy_setopt(curl, CURLOPT_URL, endpoint);
 
                break;
@@ -513,14 +515,13 @@ static void parse_configfile(struct session *session)
                        if (!strncasecmp(c, "true", 4) ||
                                        !strncasecmp(c, "yes", 3))
                                shrink_urls = 1;
-               }
-               else if (!strncasecmp(c, "verbose", 7) &&
+               } else if (!strncasecmp(c, "verbose", 7) &&
                                (c[7] == '=')) {
                        c += 8;
                        if (!strncasecmp(c, "true", 4) ||
                                        !strncasecmp(c, "yes", 3))
                                verbose = 1;
-               }       
+               }
        } while (!feof(config_file));
 
        if (password)
@@ -663,7 +664,7 @@ void read_password(char *buf, size_t len)
 
        tcgetattr(0, &tp);
        old = tp;
-       
+
        tp.c_lflag &= (~ECHO);
        tcsetattr(0, TCSANOW, &tp);
 
@@ -672,7 +673,7 @@ void read_password(char *buf, size_t len)
        scanf("%79s", pwd);
        fprintf(stdout, "\n");
 
-       tcsetattr(0, TCSANOW, &old);    
+       tcsetattr(0, TCSANOW, &old);
 
        strncpy(buf, pwd, len);
        buf[len-1] = '\0';
@@ -1143,7 +1144,6 @@ int main(int argc, char *argv[], char *envp[])
        if (!session->password) {
                read_password(password, sizeof(password));
                session->password = strdup(password);
-               free(password);
        }
 
        if (session->action == ACTION_UPDATE) {
@@ -1161,7 +1161,8 @@ int main(int argc, char *argv[], char *envp[])
 
                session->tweet = zalloc(strlen(tweet) + 10);
                if (session->bash)
-                       sprintf(session->tweet, "%c %s", getuid() ? '$' : '#', tweet);
+                       sprintf(session->tweet, "%c %s",
+                               getuid() ? '$' : '#', tweet);
                else
                        sprintf(session->tweet, "%s", tweet);