]> granicus.if.org Git - curl/commitdiff
properly free data returned by aprintf(), and bring back the code to be
authorDaniel Stenberg <daniel@haxx.se>
Sat, 25 Jul 2009 18:09:57 +0000 (18:09 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 25 Jul 2009 18:09:57 +0000 (18:09 +0000)
independent of libssh2 version as the client code isn't really meant to adapt
to such build-time constraints.

src/main.c

index 405ee3854b55c09d6bd1c771f0cb59030dc52a5a..c7669ad115e597a8698063a8d0cb329aab33fc34 100644 (file)
@@ -4694,19 +4694,19 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
           my_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
           my_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1);
         }
-#ifdef HAVE_LIBSSH2_KNOWNHOST_API
         else {
           char *home = homedir();
           char *file = aprintf("%s/%sssh/known_hosts", home, DOT_CHAR);
-          if(home && file) {
+          if(home)
             free(home);
+
+          if(file) {
             my_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file);
-            /* XXX do we need to free file here? */
+            curl_free(file);
           }
           else
             return CURLE_OUT_OF_MEMORY;
         }
-#endif
 
         if(config->no_body || config->remote_time) {
           /* no body or use remote time */