From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 0632D29D48 for ; Fri, 13 Apr 2018 04:40:32 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pJShEyyKO1N7 for ; Fri, 13 Apr 2018 04:40:31 -0400 (EDT) Received: from smtp40.i.mail.ru (smtp40.i.mail.ru [94.100.177.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id B3FFB296E8 for ; Fri, 13 Apr 2018 04:40:31 -0400 (EDT) From: "n.pettik" Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH 2/2] sql: fix tuple format leak Message-Id: <88C66C1B-1B44-46F7-A332-76294FCDFB5B@tarantool.org> Date: Fri, 13 Apr 2018 11:40:28 +0300 Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: Vladislav Shpilevoy Cc: tarantool-patches@freelists.org >1. If you use internal structures like struct iterator, then lets >manage them using internal API - iterator_delete(). I know, that >box_iterator_t is the same as struct iterator, but lets be >consistent. Fixed: - box_iterator_free(cursor->iter); + iterator_delete(cursor->iter); >2. Lets store comments near to function declarations rather >than implementations. Fixed: --- a/src/box/sql/cursor.c +++ b/src/box/sql/cursor.c @@ -33,17 +33,11 @@ #include "tarantoolInt.h" #include "box/tuple.h" =20 -/** - * Release tuple, free iterator, invalidate cursor's state. - * Note that this routine doesn't nullify space and index: - * it is also used during OP_NullRow opcode to refresh given - * cursor. - */ @@ -72,10 +66,6 @@ sqlite3CursorZero(BtCursor * p) memset(p, 0, sizeof(*p)); } =20 -/** - * Close a cursor and invalidate its state. In case of - * ephemeral cursor, corresponding space should be dropped. - */ --- a/src/box/sql/cursor.h +++ b/src/box/sql/cursor.h @@ -72,6 +72,10 @@ struct BtCursor { void sqlite3CursorZero(BtCursor *); void sqlite3CursorHintFlags(BtCursor *, unsigned); =20 +/** + * Close a cursor and invalidate its state. In case of + * ephemeral cursor, corresponding space should be dropped. + */ void sql_cursor_close(struct BtCursor *cursor); int sqlite3CursorMovetoUnpacked(BtCursor *, UnpackedRecord * pUnKey, = int *pRes); @@ -80,6 +84,12 @@ int sqlite3CursorNext(BtCursor *, int *pRes); int sqlite3CursorPrevious(BtCursor *, int *pRes); int sqlite3CursorPayload(BtCursor *, u32 offset, u32 amt, void *); =20 +/** + * Release tuple, free iterator, invalidate cursor's state. + * Note that this routine doesn't nullify space and index: + * it is also used during OP_NullRow opcode to refresh given + * cursor. + */ void sql_cursor_cleanup(struct BtCursor *cursor);