wavpack_plugin: cleanups after the last commit

* malloc() => xmalloc() for error checking
* strncpy() replaced with memcpy(),
memcpy appears perfectly safe here and mpd
does not ever use strncpy() (see r4491)

git-svn-id: https://svn.musicpd.org/mpd/trunk@7211 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Eric Wong 2008-03-26 10:38:34 +00:00
parent ad0d350f28
commit d78ddd1e50
1 changed files with 2 additions and 2 deletions

View File

@ -468,12 +468,12 @@ static int wavpack_streamdecode(OutputBuffer *cb, DecoderControl *dc,
break;
}
wvc_url = (char *)malloc(len + 2); /* +2: 'c' and EOS */
wvc_url = (char *)xmalloc(len + 2); /* +2: 'c' and EOS */
if (wvc_url == NULL) {
break;
}
strncpy(wvc_url, dc->utf8url, len);
memcpy(wvc_url, dc->utf8url, len);
wvc_url[len] = 'c';
wvc_url[len + 1] = '\0';