Commit 0485d0a6 authored by Rémi Duraffort's avatar Rémi Duraffort Committed by Derk-Jan Hartman

Fix potential memleak (CID 69)

(cherry picked from commit b9dc29f1)
parent ebc02c29
......@@ -644,7 +644,11 @@ static XTag *xtag_parse_tag( XTagParser *parser )
while (parser->end - s > 2) {
if (strncmp( s, "]]>", 3 ) == 0) {
if ( !(tag = malloc( sizeof(*tag))) ) return NULL;
if ( !(pcdata = malloc( sizeof(char)*(s - parser->start + 1))) ) return NULL;
if ( !(pcdata = malloc( sizeof(char)*(s - parser->start + 1))) )
{
free( tag );
return NULL;
}
strncpy( pcdata, parser->start, s - parser->start );
pcdata[s - parser->start]='\0';
parser->start = s = &s[3];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment