FFstrbuf: don't free string literals

This commit is contained in:
李通洲
2022-09-23 15:10:50 +08:00
parent 5498b0b042
commit 484264027c
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -549,6 +549,8 @@ uint16_t ffStrbufToUInt16(const FFstrbuf* strbuf, uint16_t defaultValue)
void ffStrbufDestroy(FFstrbuf* strbuf)
{
if(strbuf->allocated == 0) return;
//Avoid free-after-use. These 3 assignments are cheap so don't remove them
strbuf->allocated = strbuf->length = 0;
free(strbuf->chars);