summaryrefslogtreecommitdiff
path: root/src/metaflac/utils.c
diff options
context:
space:
mode:
authorJosh Coalson <jcoalson@users.sourceforce.net>2002-11-27 04:44:24 +0000
committerJosh Coalson <jcoalson@users.sourceforce.net>2002-11-27 04:44:24 +0000
commitaf396a54496fd340081d82ba11f576cac81c9ccb (patch)
tree8be9340bade031843392cdc7e6e54447069a31b0 /src/metaflac/utils.c
parent303123f93c1085646759da9a57b8cf2dbfc02dae (diff)
downloadflac-af396a54496fd340081d82ba11f576cac81c9ccb.tar.gz
fix bug in local_strcat()
Diffstat (limited to 'src/metaflac/utils.c')
-rw-r--r--src/metaflac/utils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/metaflac/utils.c b/src/metaflac/utils.c
index 07edba25..3d57f9b8 100644
--- a/src/metaflac/utils.c
+++ b/src/metaflac/utils.c
@@ -50,13 +50,13 @@ void local_strcat(char **dest, const char *source)
ndest = *dest? strlen(*dest) : 0;
nsource = strlen(source);
- *dest = realloc(*dest, ndest + nsource);
+ if(nsource == 0)
+ return;
+
+ *dest = realloc(*dest, ndest + nsource + 1);
if(0 == *dest)
die("out of memory growing string");
- if(0 == ndest)
- strcpy(*dest, source);
- else
- strcat(*dest, source);
+ strcpy((*dest)+ndest, source);
}
void hexdump(const char *filename, const FLAC__byte *buf, unsigned bytes, const char *indent)