Skip to content

Commit eb4d3cc

Browse files
authored
Merge pull request #22 from rdmrocha/master
fixing memory leak on csv parser
2 parents ebf4ae0 + 5d3e1ce commit eb4d3cc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/AdafruitIO_Data.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,13 @@ bool AdafruitIO_Data::_parseCSV()
650650
field_count--;
651651
}
652652

653+
// cleanup to avoid leaks
654+
int i = 0;
655+
while (fields[i] != NULL){
656+
free(fields[i++]);
657+
}
658+
free(fields);
659+
653660
return field_count == 0;
654661
}
655662
else

0 commit comments

Comments
 (0)