Don't ignore asprintf return value.
authorJennifer Richards <jennifer@painless-security.com>
Tue, 13 Sep 2016 20:14:45 +0000 (16:14 -0400)
committerJennifer Richards <jennifer@painless-security.com>
Mon, 19 Sep 2016 19:42:28 +0000 (15:42 -0400)
tr/tr_trp.c

index 00fb4d1..ecfc976 100644 (file)
@@ -148,7 +148,9 @@ static void tr_trps_event_cb(int listener, short event, void *arg)
     tr_debug("tr_trps_event_cb: unexpected event on TRPS socket (event=0x%X)", event);
   } else {
     /* create a thread to handle this connection */
-    asprintf(&name, "trustrouter@%s", trps->hostname);
+    if (asprintf(&name, "trustrouter@%s", trps->hostname)==-1) {
+      goto cleanup;
+    }
     gssname=tr_new_name(name);
     free(name); name=NULL;
     conn=trp_connection_accept(tmp_ctx, listener, gssname);
@@ -166,6 +168,8 @@ static void tr_trps_event_cb(int listener, short event, void *arg)
       pthread_create(trp_connection_get_thread(conn), NULL, tr_trps_thread, thread_data);
     }
   }
+
+ cleanup:
   talloc_free(tmp_ctx);
 }