From: Date: March 27 2008 12:01pm Subject: bk commit into 5.1 tree (knielsen:1.2593) BUG#35593 List-Archive: http://lists.mysql.com/commits/44504 X-Bug: 35593 Message-Id: <1206615681.0@ymer> Below is the list of changes that have just been committed into a local 5.1 repository of knielsen. When knielsen does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2008-03-27 12:01:11+01:00, knielsen@ymer.(none) +1 -0 BUG#35593: Memory leak in failed NDB execute() with blobs. During NdbTransaction::execute() with blobs, the code keeps temporary lists of operations in local variables. In case of errors in the execute(), in some scenarios these lists of operations were not linked back into the transaction object, causing them to memory leak. storage/ndb/src/ndbapi/NdbTransaction.cpp@stripped, 2008-03-27 12:01:03+01:00, knielsen@ymer.(none) +21 -0 BUG#35593: Memory leak in failed NDB execute() with blobs. During NdbTransaction::execute() with blobs, the code keeps temporary lists of operations in local variables. In case of errors in the execute(), in some scenarios these lists of operations were not linked back into the transaction object, causing them to memory leak. diff -Nrup a/storage/ndb/src/ndbapi/NdbTransaction.cpp b/storage/ndb/src/ndbapi/NdbTransaction.cpp --- a/storage/ndb/src/ndbapi/NdbTransaction.cpp 2008-02-19 16:00:27 +01:00 +++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp 2008-03-27 12:01:03 +01:00 @@ -406,6 +406,27 @@ NdbTransaction::execute(ExecType aTypeOf { if(savedError.code==0) savedError= theError; + /** + * We abort the execute here. But we still need to put the split-off + * operation list back into the transaction object, or we will get a + * memory leak. + */ + if (firstSavedOp != NULL && lastSavedOp != NULL) { + DBUG_PRINT("info", ("Rejoining ops list after postExecute between " + "%p and %p", theLastOpInList, firstSavedOp)); + if (theFirstOpInList == NULL) + theFirstOpInList = firstSavedOp; + else + theLastOpInList->next(firstSavedOp); + theLastOpInList = lastSavedOp; + } + if (tCompletedFirstOp != NULL) { + tCompletedLastOp->next(theCompletedFirstOp); + theCompletedFirstOp = tCompletedFirstOp; + if (theCompletedLastOp == NULL) + theCompletedLastOp = tCompletedLastOp; + } + DBUG_RETURN(-1); }