Pasta: fixed memory leaks, added to autobuild.

git-svn-id: svn://kolibrios.org@4833 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-04-14 15:59:17 +00:00
parent c324c5f479
commit 4e797fd374
6 changed files with 25 additions and 9 deletions

View File

@ -200,6 +200,7 @@ FASM_PROGRAMS:=\
network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \
network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \
network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.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/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \
network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \
network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \

View File

@ -200,6 +200,7 @@ FASM_PROGRAMS:=\
network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \
network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \
network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.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/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \
network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \
network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \

View File

@ -200,6 +200,7 @@ FASM_PROGRAMS:=\
network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \
network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \
network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.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/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \
network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \
network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \

View File

@ -200,6 +200,7 @@ FASM_PROGRAMS:=\
network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \
network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \
network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.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/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \
network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \
network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \

View File

@ -200,6 +200,7 @@ FASM_PROGRAMS:=\
network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \
network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \
network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.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/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \
network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \
network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \

View File

@ -55,7 +55,7 @@ START:
mov [clipboard_data], eax mov [clipboard_data], eax
mcall 70, file_struct mcall 70, file_struct
cmp eax, 6 cmp eax, 6
jne error jne error_free_clip
mov [clipboard_data_length], ebx mov [clipboard_data_length], ebx
mov eax, [clipboard_data] mov eax, [clipboard_data]
@ -77,21 +77,23 @@ clipboard:
je error je error
; Verify if we can work with it ; Verify if we can work with it
cmp dword[eax + 4], 0 ; text ?
jne error
mov [clipboard_data], eax mov [clipboard_data], eax
cmp dword[eax + 4], 0 ; text ?
jne error_free_clip
; Save length in [clipboard_data_length]
mov ecx, dword[eax] mov ecx, dword[eax]
sub ecx, 8 sub ecx, 8
mov [clipboard_data_length], ecx mov [clipboard_data_length], ecx
mov eax, [clipboard_data] ; Skip clipboard containter params for escape proc
add eax, 12 add eax, 12
escape: escape:
; Escape all characters that need escaping ; Escape all characters that need escaping
invoke HTTP_escape, eax invoke HTTP_escape, eax
test eax, eax test eax, eax
jz error jz error_free_clip
mov [clipboard_data_length], ebx mov [clipboard_data_length], ebx
push eax push eax
@ -101,7 +103,7 @@ escape:
; Connect to the server ; Connect to the server
invoke HTTP_get, sz_url, 0 invoke HTTP_get, sz_url, 0
test eax, eax test eax, eax
jz error jz error_free_clip
mov [identifier], eax mov [identifier], eax
.again: .again:
@ -139,14 +141,18 @@ escape:
add ecx, sz_paste_head.length + sz_paste_tail.length add ecx, sz_paste_head.length + sz_paste_tail.length
invoke HTTP_post, sz_url, sz_cookie, sz_ctype, ecx invoke HTTP_post, sz_url, sz_cookie, sz_ctype, ecx
test eax, eax test eax, eax
jz error jz error_free_clip
mov [identifier], eax mov [identifier], eax
; Send the data to the server
mov ecx, [eax + http_msg.socket] mov ecx, [eax + http_msg.socket]
mcall 75, 6, , sz_paste_head, sz_paste_head.length, 0 mcall 75, 6, , sz_paste_head, sz_paste_head.length, 0
mcall 75, 6, , [clipboard_data], [clipboard_data_length], 0 mcall 75, 6, , [clipboard_data], [clipboard_data_length], 0
mcall 75, 6, , sz_paste_tail, sz_paste_tail.length, 0 mcall 75, 6, , sz_paste_tail, sz_paste_tail.length, 0
; Free the data
mcall 68, 13, [clipboard_data]
.again2: .again2:
invoke HTTP_process, [identifier] invoke HTTP_process, [identifier]
test eax, eax test eax, eax
@ -154,11 +160,11 @@ escape:
mov ebp, [identifier] mov ebp, [identifier]
cmp [ebp + http_msg.status], 302 ; found cmp [ebp + http_msg.status], 302 ; found
jne error jne error_free_http
invoke HTTP_find_header_field, [identifier], sz_location invoke HTTP_find_header_field, [identifier], sz_location
test eax, eax test eax, eax
jz error jz error_free_http
push eax push eax
mov esi, sz_failed mov esi, sz_failed
@ -196,6 +202,11 @@ escape:
invoke HTTP_free, [identifier] invoke HTTP_free, [identifier]
mcall -1 mcall -1
error_free_http:
invoke HTTP_free, [identifier]
jmp error
error_free_clip:
mcall 68, 13, [clipboard_data]
error: error:
mov [notify_struct.msg], sz_failed mov [notify_struct.msg], sz_failed
mcall 70, notify_struct mcall 70, notify_struct