mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Fix memory leak: ExportStream was recreated for each table in export loop
This commit is contained in:
@ -1149,12 +1149,15 @@ begin
|
|||||||
ExportStream := TFileStream.Create(DbDir + DBObj.Name+'.sql', fmCreate or fmOpenWrite);
|
ExportStream := TFileStream.Create(DbDir + DBObj.Name+'.sql', fmCreate or fmOpenWrite);
|
||||||
FHeaderCreated := False;
|
FHeaderCreated := False;
|
||||||
end;
|
end;
|
||||||
if ToFile and (not Assigned(ExportStream)) then
|
if not Assigned(ExportStream) then begin
|
||||||
|
if ToFile then
|
||||||
ExportStream := TFileStream.Create(comboExportOutputTarget.Text, fmCreate or fmOpenWrite);
|
ExportStream := TFileStream.Create(comboExportOutputTarget.Text, fmCreate or fmOpenWrite);
|
||||||
if ToClipboard and (not Assigned(ExportStream)) then
|
// ToDir handled above
|
||||||
|
if ToClipboard then
|
||||||
ExportStream := TMemoryStream.Create;
|
ExportStream := TMemoryStream.Create;
|
||||||
if ToDb or ToServer then
|
if ToDb or ToServer then
|
||||||
ExportStream := TMemoryStream.Create;
|
ExportStream := TMemoryStream.Create;
|
||||||
|
end;
|
||||||
if not FHeaderCreated then begin
|
if not FHeaderCreated then begin
|
||||||
Header := '-- --------------------------------------------------------' + CRLF +
|
Header := '-- --------------------------------------------------------' + CRLF +
|
||||||
Format('-- %-30s%s', ['Host:', DBObj.Connection.Parameters.HostName]) + CRLF +
|
Format('-- %-30s%s', ['Host:', DBObj.Connection.Parameters.HostName]) + CRLF +
|
||||||
|
Reference in New Issue
Block a user