Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X2i6s-0004rj-Bh for pgsql-odbc@arkaria.postgresql.org; Thu, 03 Jul 2014 14:35:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X2i6q-00017X-IO for pgsql-odbc@arkaria.postgresql.org; Thu, 03 Jul 2014 14:35:36 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X2i6p-00017Q-Fv for pgsql-odbc@postgresql.org; Thu, 03 Jul 2014 14:35:35 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X2i6l-00076Z-FW for pgsql-odbc@postgresql.org; Thu, 03 Jul 2014 14:35:33 +0000 Received: (qmail 459 invoked by uid 512); 3 Jul 2014 14:35:28 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 3 Jul 2014 14:35:28 -0000 Received: from unknown (HELO ?192.168.1.8?) (183.76.63.174) by sd.tpf.co.jp with SMTP; 3 Jul 2014 14:35:28 -0000 Message-ID: <53B56A35.8070300@tpf.co.jp> Date: Thu, 03 Jul 2014 23:35:33 +0900 From: "Inoue, Hiroshi" User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: cobainpluto , "pgsql-odbc@postgresql.org" Subject: Re: Ask for two questions on psqlodbc References: In-Reply-To: Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: 0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org Hi, (2014/07/02 18:09), cobainpluto wrote: > Dear all£¬ > Recently, I used Static Code Analyzer(Fortify) to analyze > psqlodbc-09.03.0300 codes, and found two potential Memory Leak > problems in qresult.c file. > > Details are as follows : > 1.Potential Memory Leak problem > qresult.c:962: in QR_next_tuple() > 962 mres = CC_send_query(conn, movecmd, NULL, 0, stmt); > There is a dynamically allocated memory in CC_send_query_append(...). > If follow the below path, from here to RETURN (-1), the applied memory > space is not free, so it is possiblehas to generate Memory > Leak. > --------------------------------------------------------------- > qresult.c:963 - BranchNotTaken : Branch not taken: (mres != 0) > qresult.c:971 - BranchTaken : Branch taken: (sscanf(mres->command, "MOVE > %lu", (&moved)) > 0) > qresult.c:974 - BranchTaken : Branch taken: (moved < movement) > qresult.c:993 - BranchTaken : Branch taken: (2 == self->move_direction) > qresult.c:998 - BranchTaken : Branch taken: (getNthValid(self, ( expression> - 1), 4, self->move_offset, (&backpt)) < 0) > qresult.c:1004 - EndScope : RETURN(-1) It seems a memory leak. I would fix it. > --------------------------------------------------------------- > > 2¡¢Potential Null Dereference problem > qresult.c:1691: in QR_read_a_tuple_from_db() > 1691 &this_keyset->blocknum, &this_keyset->offset); > qresult.c:1693: in QR_read_a_tuple_from_db() > 1693 this_keyset->oid = strtoul(buffer, NULL, 10); > Here reference to the this_keyset. > If follow the below path,value of this_keyset is always NULL before > referring to this_keyset, so it is possiblehas to generate Null > Dereference possible. > --------------------------------------------------------------- > qresult.c:1571 - Assigned null : KeySet *this_keyset = NULL; > qresult.c:1590 - BranchNotTaken : Branch not taken: (0 == (self->flags & 1)) > qresult.c:1624 - BranchTaken : Branch taken: (field_lf < ci_num_fields) > qresult.c:1668 - BranchNotTaken : Branch not taken: (isnull == 0) > qresult.c:1676 - BranchTaken : Branch taken: (field_lf >= effective_cols) > qresult.c:1687 - BranchTaken : Branch taken: (field_lf >= effective_cols) Though I'm suspcious if it could occur, I would check it. Thanks. Hiroshi Inoue -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc