SIZED_STRING* sized_string_dup(
    SIZED_STRING* s)
{
  SIZED_STRING* result = (SIZED_STRING*) yr_malloc(
      sizeof(SIZED_STRING) + s->length);

  if (result == NULL)
    return NULL;

  result->length = s->length;
  result->flags = s->flags;

  strncpy(result->c_string, s->c_string, s->length + 1);

  return result;
}
Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.