From: Jennifer Richards Date: Tue, 13 Sep 2016 20:14:45 +0000 (-0400) Subject: Don't ignore asprintf return value. X-Git-Tag: v2.1.1~49 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=commitdiff_plain;h=eb17767495e7433c9b0d8498bb9b0b63adfd173f Don't ignore asprintf return value. --- diff --git a/tr/tr_trp.c b/tr/tr_trp.c index 00fb4d1..ecfc976 100644 --- a/tr/tr_trp.c +++ b/tr/tr_trp.c @@ -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); }