deallocate roc string in parser platform

This commit is contained in:
Folkert 2022-09-28 15:30:17 +02:00
parent 9106479d07
commit 4ada4d4996
No known key found for this signature in database
GPG Key ID: 1F17F6FFD112B97C

View File

@ -143,9 +143,22 @@ int main() {
size_t written = fwrite(str_bytes, sizeof(char), str_len, stdout);
if (fflush(stdout) == 0 && written == str_len) {
// Writing succeeded!
// dealllocate the roc string
if (!(is_small_str(str))) {
roc_dealloc(str_bytes - 8, 1);
}
return 0;
} else {
printf("Error writing to stdout: %s\n", strerror(errno));
// dealllocate the roc string
if (!(is_small_str(str))) {
roc_dealloc(str_bytes - 8, 1);
}
return 1;
}
}