diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-11-12 15:26:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-11-12 15:26:24 +0000 |
commit | 9c9800d4aa82516083bfbda3a38f0cac4944fac5 (patch) | |
tree | 24ea2e0f8e18491bf4074d281f96f6a096522c2b /usr.bin/cdio/cddb.c | |
parent | abafa2e8919d40cadcded6b038d3d11944793294 (diff) |
more asprintf; ok dhill@mindcry.org
Diffstat (limited to 'usr.bin/cdio/cddb.c')
-rw-r--r-- | usr.bin/cdio/cddb.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/cdio/cddb.c b/usr.bin/cdio/cddb.c index 89a6ea9c0df..9ea17188f55 100644 --- a/usr.bin/cdio/cddb.c +++ b/usr.bin/cdio/cddb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cddb.c,v 1.8 2003/06/09 11:33:14 espie Exp $ */ +/* $OpenBSD: cddb.c,v 1.9 2005/11/12 15:26:23 deraadt Exp $ */ /* * Copyright (c) 2002 Marc Espie. * @@ -106,11 +106,10 @@ safe_copy(char **p, const char *title) if (*p == NULL) *p = strdup(copy_buffer); else { - size_t len = strlen(*p) + strlen(copy_buffer) + 1; - char *n = malloc(len); - if (n == NULL) + char *n; + + if (asprintf(&n, "%s%s", *p, copy_buffer) == -1) return; - snprintf(n, len, "%s%s", *p, copy_buffer); free(*p); *p = n; } |