bug fixes
diff --git a/src/flac/encode.c b/src/flac/encode.c
index b3a629c..e4e0c9c 100644
--- a/src/flac/encode.c
+++ b/src/flac/encode.c
@@ -1786,10 +1786,10 @@
static FLAC__bool static_metadata_append(static_metadata_t *m, FLAC__StreamMetadata *d, FLAC__bool needs_delete)
{
void *x;
- if(0 == (x = realloc(m->metadata, sizeof(*m->metadata)*m->num_metadata+1)))
+ if(0 == (x = realloc(m->metadata, sizeof(*m->metadata)*(m->num_metadata+1))))
return false;
m->metadata = (FLAC__StreamMetadata**)x;
- if(0 == (x = realloc(m->needs_delete, sizeof(*m->needs_delete)*m->num_metadata+1)))
+ if(0 == (x = realloc(m->needs_delete, sizeof(*m->needs_delete)*(m->num_metadata+1))))
return false;
m->needs_delete = (FLAC__bool*)x;
m->metadata[m->num_metadata] = d;