From 4e797fd3748b26610ff73e408761ed6387d19307 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Mon, 14 Apr 2014 15:59:17 +0000 Subject: [PATCH] Pasta: fixed memory leaks, added to autobuild. git-svn-id: svn://kolibrios.org@4833 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/eng/Makefile | 1 + data/et/Makefile | 1 + data/it/Makefile | 1 + data/rus/Makefile | 1 + data/sp/Makefile | 1 + programs/network/pasta/pasta.asm | 29 ++++++++++++++++++++--------- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/data/eng/Makefile b/data/eng/Makefile index 2a956f6e2f..a876f8c3af 100644 --- a/data/eng/Makefile +++ b/data/eng/Makefile @@ -200,6 +200,7 @@ FASM_PROGRAMS:=\ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.asm \ + network/pasta:NETWORK/PASTA:$(PROGS)/network/pasta/pasta.asm \ network/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ diff --git a/data/et/Makefile b/data/et/Makefile index 7dc298de5c..e72389da3a 100644 --- a/data/et/Makefile +++ b/data/et/Makefile @@ -200,6 +200,7 @@ FASM_PROGRAMS:=\ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.asm \ + network/pasta:NETWORK/PASTA:$(PROGS)/network/pasta/pasta.asm \ network/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ diff --git a/data/it/Makefile b/data/it/Makefile index 4e6e3d7d5d..f0dcf313bb 100644 --- a/data/it/Makefile +++ b/data/it/Makefile @@ -200,6 +200,7 @@ FASM_PROGRAMS:=\ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.asm \ + network/pasta:NETWORK/PASTA:$(PROGS)/network/pasta/pasta.asm \ network/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ diff --git a/data/rus/Makefile b/data/rus/Makefile index 0df0be6875..1e88591787 100644 --- a/data/rus/Makefile +++ b/data/rus/Makefile @@ -200,6 +200,7 @@ FASM_PROGRAMS:=\ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.asm \ + network/pasta:NETWORK/PASTA:$(PROGS)/network/pasta/pasta.asm \ network/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ diff --git a/data/sp/Makefile b/data/sp/Makefile index 614887fc2e..7d238520ac 100644 --- a/data/sp/Makefile +++ b/data/sp/Makefile @@ -200,6 +200,7 @@ FASM_PROGRAMS:=\ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.asm \ + network/pasta:NETWORK/PASTA:$(PROGS)/network/pasta/pasta.asm \ network/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ diff --git a/programs/network/pasta/pasta.asm b/programs/network/pasta/pasta.asm index 2a38678103..e8e4117f74 100644 --- a/programs/network/pasta/pasta.asm +++ b/programs/network/pasta/pasta.asm @@ -55,7 +55,7 @@ START: mov [clipboard_data], eax mcall 70, file_struct cmp eax, 6 - jne error + jne error_free_clip mov [clipboard_data_length], ebx mov eax, [clipboard_data] @@ -77,21 +77,23 @@ clipboard: je error ; Verify if we can work with it - cmp dword[eax + 4], 0 ; text ? - jne error mov [clipboard_data], eax + cmp dword[eax + 4], 0 ; text ? + jne error_free_clip + +; Save length in [clipboard_data_length] mov ecx, dword[eax] sub ecx, 8 mov [clipboard_data_length], ecx - mov eax, [clipboard_data] +; Skip clipboard containter params for escape proc add eax, 12 escape: ; Escape all characters that need escaping invoke HTTP_escape, eax test eax, eax - jz error + jz error_free_clip mov [clipboard_data_length], ebx push eax @@ -101,7 +103,7 @@ escape: ; Connect to the server invoke HTTP_get, sz_url, 0 test eax, eax - jz error + jz error_free_clip mov [identifier], eax .again: @@ -139,14 +141,18 @@ escape: add ecx, sz_paste_head.length + sz_paste_tail.length invoke HTTP_post, sz_url, sz_cookie, sz_ctype, ecx test eax, eax - jz error + jz error_free_clip mov [identifier], eax +; Send the data to the server mov ecx, [eax + http_msg.socket] mcall 75, 6, , sz_paste_head, sz_paste_head.length, 0 mcall 75, 6, , [clipboard_data], [clipboard_data_length], 0 mcall 75, 6, , sz_paste_tail, sz_paste_tail.length, 0 +; Free the data + mcall 68, 13, [clipboard_data] + .again2: invoke HTTP_process, [identifier] test eax, eax @@ -154,11 +160,11 @@ escape: mov ebp, [identifier] cmp [ebp + http_msg.status], 302 ; found - jne error + jne error_free_http invoke HTTP_find_header_field, [identifier], sz_location test eax, eax - jz error + jz error_free_http push eax mov esi, sz_failed @@ -196,6 +202,11 @@ escape: invoke HTTP_free, [identifier] mcall -1 +error_free_http: + invoke HTTP_free, [identifier] + jmp error +error_free_clip: + mcall 68, 13, [clipboard_data] error: mov [notify_struct.msg], sz_failed mcall 70, notify_struct