Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit e496778

Browse files
livecodestephenrunrevmark
authored andcommitted
Fix potential leak in MCNameCreateWithNativeChars()
1 parent d6133fd commit e496778

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libfoundation/src/foundation-name.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,12 @@ bool MCNameCreateWithNativeChars(const char_t *p_chars, uindex_t p_count, MCName
171171
MCStringRef t_string;
172172
if (!MCStringCreateWithNativeChars(p_chars, p_count, t_string))
173173
return false;
174-
return MCNameCreateAndRelease(t_string, r_name);
174+
if (!MCNameCreateAndRelease(t_string, r_name))
175+
{
176+
MCValueRelease(t_string);
177+
return false;
178+
}
179+
return true;
175180
}
176181

177182
bool MCNameCreateWithChars(const unichar_t *p_chars, uindex_t p_count, MCNameRef& r_name)

0 commit comments

Comments
 (0)