]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Avoid memory leak in error messages in control.c (not in any tor)
authorNick Mathewson <nickm@torproject.org>
Thu, 23 Apr 2015 13:26:31 +0000 (09:26 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 23 Apr 2015 13:26:39 +0000 (09:26 -0400)
src/or/control.c

index bbc4115d1001f75807e240e6c9ff7790206331b9..547145bbe91a1fa0166d9d677ecf65f6402f44d9 100644 (file)
@@ -1716,13 +1716,11 @@ getinfo_helper_dir(control_connection_t *control_conn,
     SMARTLIST_FOREACH(sl, char *, c, tor_free(c));
     smartlist_free(sl);
   } else if (!strcmpstart(question, "hs/client/desc/id/")) {
-    char *msg;
     rend_cache_entry_t *e = NULL;
 
     question += strlen("hs/client/desc/id/");
     if (strlen(question) != REND_SERVICE_ID_LEN_BASE32) {
-      tor_asprintf(&msg, "\"%s\" invalid address.", question);
-      *errmsg = msg;
+      *errmsg = "Invalid address";
       return -1;
     }
 
@@ -1730,8 +1728,7 @@ getinfo_helper_dir(control_connection_t *control_conn,
       /* Descriptor found in cache */
       *answer = tor_strdup(e->desc);
     } else {
-      tor_asprintf(&msg, "\"%s\" not found in cache.", question);
-      *errmsg = msg;
+      *errmsg = "Not found in cache";
       return -1;
     }
   } else if (!strcmpstart(question, "md/id/")) {