cleanup reading from interface, when argArrayLength returned by buffer2array

is 0, we weren't dealing with this well at all!

git-svn-id: https://svn.musicpd.org/mpd/trunk@559 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes
2004-03-31 16:15:09 +00:00
parent 9e382536dc
commit f641d046fa
2 changed files with 19 additions and 3 deletions

View File

@@ -61,6 +61,12 @@ int buffer2array(char * origBuffer, char *** array) {
}
markArray[bufferLength] = '\0';
if(!count) {
free(buffer);
free(markArray);
return count;
}
beginArray = malloc(sizeof(int)*count);
(*array) = malloc(sizeof(char *)*count);
@@ -107,6 +113,8 @@ int buffer2array(char * origBuffer, char *** array) {
void freeArgArray(char ** array, int argArrayLength) {
int i;
if(argArrayLength==0) return;
for(i=0;i<argArrayLength;i++) {
free(array[i]);
}