svn commit: r295274 - user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools
Garrett Cooper
ngie at FreeBSD.org
Thu Feb 4 18:12:43 UTC 2016
Author: ngie
Date: Thu Feb 4 18:12:42 2016
New Revision: 295274
URL: https://svnweb.freebsd.org/changeset/base/295274
Log:
Use strdup instead of asprintf; asprintf is pretty heavyweight for
copying just a buffer
Reminded by: bde's email
Modified:
user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
Modified: user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
==============================================================================
--- user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Thu Feb 4 18:08:50 2016 (r295273)
+++ user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Thu Feb 4 18:12:42 2016 (r295274)
@@ -272,7 +272,7 @@ enum_pair_insert(struct enum_pairs *head
return (-1);
}
- if (asprintf(&e_new->enum_str, "%s", enum_str) == -1) {
+ if ((e_new->enum_str = strdup(enum_str)) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
free(e_new);
return (-1);
@@ -556,7 +556,7 @@ snmp_enumtc_init(char *name)
return (NULL);
}
- if (asprintf(&enum_tc->name, "%s", name) == -1) {
+ if ((enum_tc->name = strdup(name)) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
free(enum_tc);
return (NULL);
More information about the svn-src-user
mailing list