fixing a memory leak in the clipboard

git-svn-id: svn://kolibrios.org@9265 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2021-11-14 14:02:16 +00:00
parent a5f6a10b43
commit f62bef13d5

View File

@ -50,14 +50,12 @@ align 4
dec ebx ; 2 - Write the data to the clipboard dec ebx ; 2 - Write the data to the clipboard
jnz .3 jnz .3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; check pointer on kernel address
stdcall is_region_userspace, edx, ecx stdcall is_region_userspace, edx, ecx
jz @f jz @f
mov eax, -1 mov eax, -1
jmp .exit_1 jmp .exit_1
@@: @@:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; check the lock ; check the lock
mov ebx, clipboard_write_lock mov ebx, clipboard_write_lock
xor eax, eax xor eax, eax
@ -81,6 +79,8 @@ align 4
shl eax, 2 shl eax, 2
add eax, [clipboard_main_list] add eax, [clipboard_main_list]
mov [eax], edi mov [eax], edi
push edi ;save pointer to data
push ecx ;save size data
; copy the data into the slot ; copy the data into the slot
mov esi, edx mov esi, edx
mov eax, ecx mov eax, ecx
@ -89,6 +89,10 @@ align 4
sub ecx, 4 sub ecx, 4
add esi, 4 add esi, 4
rep movsb ; store slot data rep movsb ; store slot data
;copy ecx in Dword[clipboard_main_list+clipboard_slots*4]
pop ecx
pop eax
mov [eax], ecx
; increase the counter of slots ; increase the counter of slots
inc [clipboard_slots] inc [clipboard_slots]
; unlock last slot ; unlock last slot