title: Why is this code causing a SegFault at result.create?
body: <p>I've got a list of about 10K names &amp; addresses that needs cleaning, I've managed to get the addresses cleaned and am now extending the program to cater for the other fields, my code compiles without any issues, however when I try to run the program highlighting the following</p>
  
  <pre><code>000000010000DD9E 743d                     je     0x10000dddd 
  &lt;SYSTEM$_$TOBJECT_$__$$_CREATE$$TOBJECT+125&gt;
  </code></pre>
  
  <p>The only create command in the code relates to a stringlist that I'm using to store splitted info before casting it to a variable, before sending it to a seperate SdfDataSet, my code worked perfectly when I was just dealing with the addresses so why is it now failing? I thought it might be because seperate stringLists were required but creating anymore than one list causes the same problem.</p>
  
  <p>Forgive the fairly large chunk of code:</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);
  var
    i : Integer;
    title, str1, str2, str3, str4, address : String;
    result : TStringList;
  
  begin
    // Add field to address data set
    AddressData.FieldDefs.Add('Title', ftString); // 0
    AddressData.Schema.Add('Title');
    AddressData.FieldDefs.Add('Fore', ftString); // 1
    AddressData.Schema.Add('Fore');
    AddressData.FieldDefs.Add('Sur', ftString); // 2
    AddressData.Schema.Add('Sur');
    AddressData.FieldDefs.Add('Address', ftString); // 3
    AddressData.Schema.Add('Address');
    AddressData.Active := True;
    AddressData.Edit;
  
    result.Create;  // This seems to be the problem
  
    // Begin export
    with Initial_Data do begin
    for i := 1 to RecordCount do
     begin
      RecNo := i;
      title := Fields[13].AsString;
      str1 := Fields[8].AsString;
      str2 := Fields[9].AsString;
      str3 := Fields[10].AsString;
      str4 := Fields[11].AsString;
  
      // Clean Titles
      // Split at first space or period
      if title &lt;&gt; '' then
        begin
          ExtractStrings([' ', '.'], [' '], PChar(title), result);
          title := result[0];
        end
      else title := null;
  
  
      // Concentate Addresses
      // Check markup of string 1
      if (AnsiEndsStr(',', str1) = False) then
        str1 := str1 + ', '
      else
        if (AnsiEndsStr(',', str1) = True) then
          str1 := str1 + ' ';
  
      // Check markup of string 2
      if (AnsiEndsStr(',', str2) = False) then
        if str3 = '' then
          str2 := str2
        else
          str2 := str2 + ', '
      else
        if (AnsiEndsStr(',', str2) = True) then
          if str3 &lt;&gt; '' then
            str2 := str2 + ' ';
  
      // Markup for string 3
      if (AnsiEndsStr(',', str3) = False) then
        if str4 = '' then
          str3 := str3
        else
          str3 := str3 + ', '
      else
      if (AnsiEndsStr(',', str3) = True) then
        if str4 &lt;&gt; '' then
          str3 := str3 + ' ';
  
      // Cleanup final string
      if (AnsiEndsStr('.', str4) = True) then
        begin
          ExtractStrings(['.'], [' '], PChar(str4), result);
          str4 := result[0];
        end
      else
        if (AnsiEndsStr(',', str4) = True) then
        begin
          ExtractStrings([','], [' '], PChar(str4), result);
          str4 := result[0];
        end;
  
      // Compile address
      address := str1 + str2 + str3 + str4;
  
      // Add records to address
      with AddressData do
        begin
          RecNo := i;
          Insert;
          Fields[0].AsString := title;
          Fields[3].AsString := address;
          Post;
        end;
  
      if result[0] &lt;&gt; '' then
      result.Free;
  
    end; // Close of for loop
  end;
  
    AddressData.Refresh;
  end; 
  </code></pre>