提交 5720a4cd 编写于 作者: E Emmanuel Leblond 提交者: GitHub

Merge pull request #77 from ndevilla/issue-73

Fix issue #73
...@@ -689,6 +689,7 @@ dictionary * iniparser_load(const char * ininame) ...@@ -689,6 +689,7 @@ dictionary * iniparser_load(const char * ininame)
int len ; int len ;
int lineno=0 ; int lineno=0 ;
int errs=0; int errs=0;
int mem_err=0;
dictionary * dict ; dictionary * dict ;
...@@ -747,12 +748,12 @@ dictionary * iniparser_load(const char * ininame) ...@@ -747,12 +748,12 @@ dictionary * iniparser_load(const char * ininame)
break ; break ;
case LINE_SECTION: case LINE_SECTION:
errs = dictionary_set(dict, section, NULL); mem_err = dictionary_set(dict, section, NULL);
break ; break ;
case LINE_VALUE: case LINE_VALUE:
sprintf(tmp, "%s:%s", section, key); sprintf(tmp, "%s:%s", section, key);
errs = dictionary_set(dict, tmp, val) ; mem_err = dictionary_set(dict, tmp, val);
break ; break ;
case LINE_ERROR: case LINE_ERROR:
...@@ -768,7 +769,7 @@ dictionary * iniparser_load(const char * ininame) ...@@ -768,7 +769,7 @@ dictionary * iniparser_load(const char * ininame)
} }
memset(line, 0, ASCIILINESZ); memset(line, 0, ASCIILINESZ);
last=0; last=0;
if (errs<0) { if (mem_err<0) {
fprintf(stderr, "iniparser: memory allocation failure\n"); fprintf(stderr, "iniparser: memory allocation failure\n");
break ; break ;
} }
......
#
# This dict contains an error but ends up with a correct entry
#
[section]
error is here
a = b
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册