aboutsummaryrefslogtreecommitdiffstats
path: root/src/ini_read.c
diff options
context:
space:
mode:
authorM.Gergő2020-05-27 01:30:33 +0200
committerM.Gergő2020-05-27 01:30:33 +0200
commitf7ad1d4158a1efaf620801673b364a3705b98aef (patch)
treebc7cbaf900130f049ece308d70d6cbba523af28e /src/ini_read.c
parent5872c7cb7620a60b0921c6936d7bf5fad3dd94ff (diff)
downloadlightconfini-1.2.0.tar.gz
lightconfini-1.2.0.zip
Library OK1.2.0
Diffstat (limited to 'src/ini_read.c')
-rw-r--r--src/ini_read.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ini_read.c b/src/ini_read.c
index 66799a1..e58bc80 100644
--- a/src/ini_read.c
+++ b/src/ini_read.c
@@ -588,7 +588,7 @@ struct lcini_data *iniFSM(struct lcini_data *data, const uint8_t *in, int32_t le
lcini_data *lciniCreateNode( lcini_data *head, int lineLen ){ /* Creates one Node */
lcini_data *curr;
- curr = (lcini_data *) malloc(1*sizeof(lcini_data));
+ curr = (lcini_data *) calloc(1, sizeof(lcini_data));
curr->nodeState = lcini_EMPTY;
curr->lineNum = 0;
curr->lineLen = lineLen;
@@ -600,6 +600,11 @@ lcini_data *lciniCreateNode( lcini_data *head, int lineLen ){ /* Creates one Nod
curr->comment = (uint8_t *) calloc(lineLen, sizeof(uint8_t));
curr->errorMsg = (uint8_t *) calloc(lineLen, sizeof(uint8_t));
} else {
+ curr->section = NULL;
+ curr->param = NULL;
+ curr->value = NULL;
+ curr->comment = NULL;
+ curr->errorMsg = NULL;
lineLen = 0;
}
curr->sectionLen = lineLen;
@@ -641,7 +646,7 @@ lcini_data *lciniDestroyNodes( lcini_data *head){ /* Destroys Nodes from HEAD to
lcini_shortret *lciniMKShortRet(int bufflen){
lcini_shortret *dt=NULL;
- dt = (lcini_shortret *) malloc(1*sizeof(lcini_shortret));
+ dt = (lcini_shortret *) calloc(1, sizeof(lcini_shortret));
if(dt){
dt->ret = (char *) calloc(bufflen, sizeof(char));
dt->retlen = bufflen;
@@ -747,7 +752,7 @@ struct lcini_data *lciniReadOut(const char *filename){ /* Reads the entire
}
return list;
}
-
+
int lciniReadOutOwn(const char *filename){ /* Reads the entire file to a linked-list */