Skip to content
Snippets Groups Projects
Commit a4d2afff authored by rswindell's avatar rswindell
Browse files

Added NULL fp checking str_list_read_file().

parent 039aee69
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* * * *
* Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html * * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* * * *
* This library is free software; you can redistribute it and/or * * This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
...@@ -373,6 +373,7 @@ static str_list_t str_list_read_file(FILE* fp, str_list_t* lp, size_t max_line_l ...@@ -373,6 +373,7 @@ static str_list_t str_list_read_file(FILE* fp, str_list_t* lp, size_t max_line_l
lp=&list; lp=&list;
} }
if(fp!=NULL) {
count=strListCount(*lp); count=strListCount(*lp);
while(!feof(fp)) { while(!feof(fp)) {
if(buf==NULL && (buf=(char*)alloca(max_line_len+1))==NULL) if(buf==NULL && (buf=(char*)alloca(max_line_len+1))==NULL)
...@@ -382,6 +383,7 @@ static str_list_t str_list_read_file(FILE* fp, str_list_t* lp, size_t max_line_l ...@@ -382,6 +383,7 @@ static str_list_t str_list_read_file(FILE* fp, str_list_t* lp, size_t max_line_l
break; break;
strListAppend(lp, buf, count++); strListAppend(lp, buf, count++);
} }
}
return(*lp); return(*lp);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment