summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/asn.1
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2008-10-20 18:18:49 +0000
committerGreg Hudson <ghudson@mit.edu>2008-10-20 18:18:49 +0000
commite4a2f122c3086c1179323c0e24edb3506d3f4758 (patch)
tree310614d952144eaba5f2e0a1aec7f86af40862de /src/lib/krb5/asn.1
parent4c6801514e9ee5e6459780d37bc4a83429dd4746 (diff)
downloadkrb5-e4a2f122c3086c1179323c0e24edb3506d3f4758.tar.gz
krb5-e4a2f122c3086c1179323c0e24edb3506d3f4758.tar.xz
krb5-e4a2f122c3086c1179323c0e24edb3506d3f4758.zip
Use strdup in place of malloc/strcpy in many places
ticket: 6200 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20898 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/asn.1')
-rw-r--r--src/lib/krb5/asn.1/asn1buf.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/krb5/asn.1/asn1buf.c b/src/lib/krb5/asn.1/asn1buf.c
index 49ef84fbb..4162c9ee5 100644
--- a/src/lib/krb5/asn.1/asn1buf.c
+++ b/src/lib/krb5/asn.1/asn1buf.c
@@ -276,13 +276,11 @@ asn1_error_code asn1buf_unparse(const asn1buf *buf, char **s)
{
free(*s);
if (buf == NULL) {
- *s = malloc(sizeof("<NULL>"));
+ *s = strdup("<NULL>");
if (*s == NULL) return ENOMEM;
- strcpy(*s,"<NULL>");
} else if (buf->base == NULL) {
- *s = malloc(sizeof("<EMPTY>"));
+ *s = strdup("<EMPTY>");
if (*s == NULL) return ENOMEM;
- strcpy(*s,"<EMPTY>");
} else {
unsigned int length = asn1buf_len(buf);
unsigned int i;
@@ -305,13 +303,11 @@ asn1_error_code asn1buf_hex_unparse(const asn1buf *buf, char **s)
free(*s);
if (buf == NULL) {
- *s = malloc(sizeof("<NULL>"));
+ *s = strdup("<NULL>");
if (*s == NULL) return ENOMEM;
- strcpy(*s,"<NULL>");
} else if (buf->base == NULL) {
- *s = malloc(sizeof("<EMPTY>"));
+ *s = strdup("<EMPTY>");
if (*s == NULL) return ENOMEM;
- strcpy(*s,"<EMPTY>");
} else {
unsigned int length = asn1buf_len(buf);
int i;