Bug #36887 Typo in mysql_client_test.c uses bind instead of my_bind
Submitted: 22 May 2008 15:07 Modified: 29 Jul 2008 9:53
Reporter: Vasil Dimov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0, 4.1 BK OS:Any
Assigned to: Georgi Kodinov CPU Architecture:Any
Tags: bind my_bind

[22 May 2008 15:07] Vasil Dimov
Description:
While compiling latest 5.0 source:

mysql_client_test.c: In function 'test_bug5194':
mysql_client_test.c:11678: warning: the address of 'bind' will never be NULL

11673   my_bind= (MYSQL_BIND*) malloc(MAX_PARAM_COUNT * sizeof(MYSQL_BIND));
11674   query= (char*) malloc(strlen(query_template) +
11675                         MAX_PARAM_COUNT * CHARS_PER_PARAM + 1);
11676   param_str= (char*) malloc(COLUMN_COUNT * CHARS_PER_PARAM);
11677 
11678   if (bind == 0 || query == 0 || param_str == 0)
11679   {
11680     fprintf(stderr, "Can't allocate enough memory for query structs\n");
11681     if (my_bind)
11682       free(my_bind);
11683     if (query)
11684       free(query);
11685     if (param_str)
11686       free(param_str);
11687     return;
11688   }

it should of course be "if (my_bind ..."

How to repeat:
Compile 5.0 with -Wall and observe the warning, then read the code.
[22 May 2008 16:26] Sveta Smirnova
Thank you for the report.

Verified as described using code analisys. Fixed in versions >= 5.1
[28 Jul 2008 13:28] Georgi Kodinov
Pushed in 5.0.68. Null merged to 5.1 and 6.0
[28 Jul 2008 13:49] Bugs System
Pushed into 5.0.64  (revid:kgeorge@mysql.com-20080527113308-975c60xc3gdm2gqc) (pib:2)
(Retry automatic marking, to ensure nothing is missed. cm01)
[28 Jul 2008 16:50] Bugs System
Pushed into 5.1.27  (revid:joerg@mysql.com-20080626161101-h5hsaluwtf05xdr2) (version source revid:joerg@mysql.com-20080626161101-h5hsaluwtf05xdr2) (pib:3)
[28 Jul 2008 18:00] Paul DuBois
Test suite change. No 5.0.x/5.1.x changelog entry needed.

Setting report to Patch Queued pending push of fix into 6.0.x.
[29 Jul 2008 8:51] Georgi Kodinov
As mentioned : it was a 5.0-only problem. 5.1 and 6.0 are not affected. so I've null-merged the 5.0-change.
[29 Jul 2008 9:53] Jon Stephens
Closed, per comment from Paul.