From b63d429c8f2c68994600d98bfaddf59ca16fc889 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Tue, 1 Jan 2013 11:04:21 +0100 Subject: Provide dealloc function to ipodpatcher. On Windows the sector buffer is allocated using VirtualAlloc, thus releasing this buffer should be done using VirtualFree. Provide an additional function for deallocating the buffer so users of ipodpatcher do not need to know about this. Change-Id: Ibb0fc575a185148a389e63935e86a392bf8d180d --- rbutil/ipodpatcher/ipodio-win32.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'rbutil/ipodpatcher/ipodio-win32.c') diff --git a/rbutil/ipodpatcher/ipodio-win32.c b/rbutil/ipodpatcher/ipodio-win32.c index d4bdbf0173..cea218774a 100644 --- a/rbutil/ipodpatcher/ipodio-win32.c +++ b/rbutil/ipodpatcher/ipodio-win32.c @@ -170,6 +170,19 @@ int ipod_alloc_buffer(struct ipod_t* ipod, int bufsize) return 0; } +int ipod_dealloc_buffer(struct ipod_t* ipod) +{ + if (ipod->sectorbuf == NULL) { + return -1; + } + if(!VirtualFree(ipod->sectorbuf, 0, MEM_RELEASE)) { + ipod_print_error(" Error releasing buffer "); + return -1; + } + ipod->sectorbuf = NULL; + return 0; +} + int ipod_seek(struct ipod_t* ipod, unsigned long pos) { if (SetFilePointer(ipod->dh, pos, NULL, FILE_BEGIN)==0xffffffff) { -- cgit v1.2.3