看看那个对象没有free;或者装个Eurekalog查一下就知道了

解决方案 »

  1.   

    代码太长了!我把Tstring去掉也是提示这个。
      

  2.   

    function MyFun(p: Pointer): Integer; stdcall;
    var
     Item: TListItem;
    mylist5:Tstringlist;
    i,t,g:integer;
    success: Integer;
    hostname: PWideChar;
    port: Integer;
    channelNum: Integer;
    termType: PWideChar;
    widthInChars: Integer;
    heightInChars: Integer;
    pixWidth: Integer;
    pixHeight: Integer;
    n: Integer;
    pollTimeoutMs: Integer;
    cmdOutput:widestring;
    begin
     try
      for i:=0 to mylist3.Count-1 do
      begin
     begin  g:=0;
      for t:=0 to mylist4.Count-1 do
      begin
     if  g<mylist4.Count then
      begin
       try
        mylist5:=Tstringlist.create;
       mylist5.Clear;
       try
    success := ssh.UnlockComponent('30-day trial');
    if (success <> 1) then
      begin
     mylist5.Add(ssh.LastErrorText);
      end;
    hostname := DoStrToWideChar( mylist4.Strings[g]);
    port := 22;success := ssh.Connect(hostname,port);
    if (success <> 1) then
      begin
        mylist5.Add(ssh.LastErrorText);  end;ssh.IdleTimeoutMs :=4000;
    //sleep(4000);
    success := ssh.AuthenticatePw(Form1.Edit11.text,mylist3.Strings[i]);
    if (success <> 1) then
      begin
        mylist5.Add(ssh.LastErrorText);
     end;channelNum := ssh.OpenSessionChannel();
    if (channelNum < 0) then
      begin mylist5.Add(ssh.LastErrorText);
      end;
    termType := 'dumb';
    widthInChars := 120;
    heightInChars := 40;
    pixWidth := 0;
    pixHeight := 0;
    success := ssh.SendReqPty(channelNum,termType,widthInChars,heightInChars,pixWidth,pixHeight);
    if (success <> 1) then
      begin
       mylist5.Add(ssh.LastErrorText);
      end;success := ssh.SendReqShell(channelNum);
    if (success <> 1) then
      begin
        mylist5.Add(ssh.LastErrorText);
      end;
     success := ssh.ChannelSendString(channelNum,'ls'+ #13#10,'ansi');
    if (success <> 1) then
      begin
       mylist5.Add(ssh.LastErrorText);
      end;success := ssh.ChannelSendEof(channelNum);
    if (success <> 1) then
      begin
        mylist5.Add(ssh.LastErrorText);
      end;
    pollTimeoutMs:=2000;
    n := ssh.ChannelReadAndPoll(channelNum,pollTimeoutMs);
    if (n < 0) then
      begin
      mylist5.Add(ssh.LastErrorText);  end;success := ssh.ChannelSendClose(channelNum);
    if (success <> 1) then
      begin
       mylist5.Add(ssh.LastErrorText);
      end;
    success := ssh.ChannelReceiveToClose(channelNum);
    if (success <> 1) then
      begin
      mylist5.Add(ssh.LastErrorText);
      end;cmdOutput := ssh.GetReceivedText(channelNum,'us-ascii');
    if (Length(cmdOutput) = 0 ) then
      begin
      mylist5.Add(ssh.LastErrorText);
      end;mylist5.Add(cmdOutput);
       ssh.Disconnect();
      except
      end;
        if  (POS('#',mylist5.text)>0) or (POS('$',mylist5.text)>0) then
        begin
          Item := Form1.ListView1.Items.Add;
           Item.Caption:=inttostr(Form1.ListView1.Items.Count);
            Item.SubItems.Add(Form1.Edit11.text);
            Item.SubItems.Add(mylist3.Strings[i]);
            Item.SubItems.Add(mylist4.Strings[g]);
            Item.SubItems.Add(DateTimeToStr(now()));
        // Form1.Memo7.Lines.Add('用户名:'+b+'  '+'密码:'+a+'  '+'ip地址:'+c); end;
     //
       Form1.listview2.Items[0].SubItems.strings[0]:=mylist3.Strings[i];
     Form1.listview2.Items[0].SubItems.strings[1]:=mylist4.Strings[g];
      g:=g+100;
       mylist5.Free;
      except
      end;
      end;
    if  i= mylist3.Count-1 thenbegin
    Form1.listview2.Items[0].SubItems.strings[2]:='完成';end;
    ClearMemory;
      end; end;  end;
      except
      end;
      Result :=0;
     end;
      

  3.   

       安全用法:
       aList := TStringList.Create;
        try
         //....
        finally
         aList .Clear;
         aList .Free;
        end;