Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Feb 2015 19:57:39 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r278594 - head/usr.sbin/ctld
Message-ID:  <201502111957.t1BJvdPT086968@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Feb 11 19:57:38 2015
New Revision: 278594
URL: https://svnweb.freebsd.org/changeset/base/278594

Log:
  Add missing asprintf() status checks.
  
  MFC after:	2 weeks

Modified:
  head/usr.sbin/ctld/ctld.c

Modified: head/usr.sbin/ctld/ctld.c
==============================================================================
--- head/usr.sbin/ctld/ctld.c	Wed Feb 11 19:53:44 2015	(r278593)
+++ head/usr.sbin/ctld/ctld.c	Wed Feb 11 19:57:38 2015	(r278594)
@@ -1191,8 +1191,11 @@ port_new(struct conf *conf, struct targe
 {
 	struct port *port;
 	char *name;
+	int ret;
 
-	asprintf(&name, "%s-%s", pg->pg_name, target->t_name);
+	ret = asprintf(&name, "%s-%s", pg->pg_name, target->t_name);
+	if (ret <= 0)
+		log_err(1, "asprintf");
 	if (port_find(conf, name) != NULL) {
 		log_warnx("duplicate port \"%s\"", name);
 		free(name);
@@ -1216,8 +1219,11 @@ port_new_pp(struct conf *conf, struct ta
 {
 	struct port *port;
 	char *name;
+	int ret;
 
-	asprintf(&name, "%s-%s", pp->pp_name, target->t_name);
+	ret = asprintf(&name, "%s-%s", pp->pp_name, target->t_name);
+	if (ret <= 0)
+		log_err(1, "asprintf");
 	if (port_find(conf, name) != NULL) {
 		log_warnx("duplicate port \"%s\"", name);
 		free(name);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502111957.t1BJvdPT086968>