Project

General

Profile

Actions

Bug #6453

closed

Memory leak in MySQL.C

Added by Olaf Bonorden over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
06/18/2018
Due date:
% Done:

0%

Estimated time:
0:00 h

Description

In MySQL.C in function bind_output in line 822 an array of my_bool is allocated. This array is not used at all (pointers to elements are used in line 826 but overwritten by mallocs in line 879.

The local variable is destroyed without deleting the array.

Actions #1

Updated by Roel Standaert over 6 years ago

Are you referring to errors_? That doesn't seem to be local. It's a member of MySQLStatement and is freed in its destructor. It does seem like it's never used, indeed. I guess it was intended as an optimization so it doesn't need to do a single-char malloc for every error, but then the code mistakenly still does a malloc for every error anyway. I'll see if I can safely remove that extra malloc for every error.

Actions #2

Updated by Roel Standaert over 6 years ago

  • Status changed from New to Resolved

I just pushed a commit that removes the extra malloc for every error field.

Actions #3

Updated by Olaf Bonorden over 6 years ago

You're right, sorry, I should not use a browser to look at source code in the middle of the night.

Would it be possible to also initialize the error fields before calling mysql_stmt_bind_result? Some versions of maria db do not clear the flag, leading to issue https://redmine.emweb.be/issues/6407.

Actions #4

Updated by Roel Standaert over 6 years ago

Yes, I also fixed that yesterday. Is there still a problem with that?

Actions #5

Updated by Roel Standaert over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF