Skip to content

Commit

Permalink
xml: fix xml_location_create refcount memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomaschewski committed Jul 14, 2015
1 parent 29078af commit e56061a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/xml-reader.c
Expand Up @@ -918,8 +918,14 @@ xml_location_new(struct xml_location_shared *shared_location, unsigned int line)
inline xml_location_t *
xml_location_create(const char *filename, unsigned int line)
{
return filename ?
xml_location_new(xml_location_shared_new(filename), line) : NULL;
xml_location_t *location;

if (ni_string_empty(filename))
return NULL;

location = xml_location_new(xml_location_shared_new(filename), line);
xml_location_shared_release(location->shared);
return location;
}

void
Expand Down

0 comments on commit e56061a

Please sign in to comment.