aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 57d8723..903ec1a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -284,9 +284,12 @@ void readlist(FILE *f){
char *line = NULL;
size_t slen = 0;
ssize_t read;
- if((read = getline(&line, &slen, f)) > 0){
+ read = getline(&line, &slen, f);
+ if(read > 1){
line[read-1] = '\0';
images[imageslen++] = line;
+ }else if(line){
+ free(line);
}
}
lsize *= 2;