memory leak in nmea_parser_real_push
Brought to you by:
xtimor
There are some possible memory leaks in each case statement of the function nmea_parser_real_push. The sample below illustrates the problem and gives the solution.
case GPGGA:
if(0 == (node->pack = malloc(sizeof(nmeaGPGGA)))) /* The block allocated here is not released when the function nmea_parse_GPGGA fails */
goto mem_fail;
node->packType = GPGGA;
if(!nmea_parse_GPGGA(
(const char *)parser->buffer + nparsed,
sen_sz, (nmeaGPGGA *)node->pack))
{
free(node->pack); /*This line is missing and this leads to a memory leaks*/
free(node);
node = 0;
}
break;
Project was forked to https://github.com/ahr-project/nmealib because it was not active here.
Please file the issue there.