aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer2array.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer2array.c')
-rw-r--r--src/buffer2array.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/buffer2array.c b/src/buffer2array.c
index 40247bde7..9ee67f17c 100644
--- a/src/buffer2array.c
+++ b/src/buffer2array.c
@@ -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]);
}