gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-25


From: Daniele Forsi
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-259-g8130fae
Date: Wed, 06 Jul 2011 09:30:44 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  8130fae58f6ce93a48514b2a9f1790f52a3cda60 (commit)
      from  d6207bb724e24fa7bf89464002329b933d479276 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=8130fae58f6ce93a48514b2a9f1790f52a3cda60


commit 8130fae58f6ce93a48514b2a9f1790f52a3cda60
Author: Daniele Forsi <address@hidden>
Date:   Wed Jul 6 11:27:10 2011 +0200

    The caller avoids a memory leak by always freeing the buffer
    
    When pcsc_file_get_contents() returns ios->pbRecvBuffer is either
    NULL or a valid pointer.

diff --git a/common/phones/pcsc.c b/common/phones/pcsc.c
index bc04c0f..62deb1f 100644
--- a/common/phones/pcsc.c
+++ b/common/phones/pcsc.c
@@ -1248,7 +1248,8 @@ static LONG pcsc_cmd_read_record(PCSC_IOSTRUCT *ios, BYTE 
record, BYTE length)
 
 static LONG pcsc_file_get_contents(PCSC_IOSTRUCT *ios, LONG file_id)
 {
-/* copy file contents in a newly allocated buffer which must be freed by the 
caller
+/* copy file contents in a newly allocated buffer ios->pbRecvBuffer which must
+be freed by the caller also in case of error return.
 Note that this function overwrites ios->pbRecvBuffer and ios->dwRecvLength
 */
        LONG ret;
@@ -1257,7 +1258,7 @@ Note that this function overwrites ios->pbRecvBuffer and 
ios->dwRecvLength
 
        /* allocate a buffer for the "stat" command */
        ios->dwRecvLength = MAX_BUFFER_SIZE;
-       ios->pbRecvBuffer = malloc(ios->dwRecvLength);  /* FIXME this memory is 
leaked after the following errors */
+       ios->pbRecvBuffer = malloc(ios->dwRecvLength);
        if (!ios->pbRecvBuffer) return SCARD_E_NO_MEMORY;
 
        ret = pcsc_stat_file(ios, file_id);

-----------------------------------------------------------------------

Summary of changes:
 common/phones/pcsc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]