| Bug #47130 | misplaced or redundant check for null pointer ? | ||
|---|---|---|---|
| Submitted: | 4 Sep 2009 10:49 | Modified: | 18 Dec 2009 23:52 |
| Reporter: | Shane Bester (Platinum Quality Contributor) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: General | Severity: | S3 (Non-critical) |
| Version: | 5.1.39 | OS: | Any |
| Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
[11 Sep 2009 17:07]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/83077 3120 Ramil Kalimullin 2009-09-11 Fix for bug#47130: misplaced or redundant check for null pointer? Problem: LOGGER::general_log_write() relied on valid "thd" parameter passed but had inconsistent "if (thd)" check. Fix: as we always pass a valid "thd" parameter to the method, redundant check removed. @ sql/log.cc Fix for bug#47130: misplaced or redundant check for null pointer? - code clean-up, as we rely on the "thd" parameter in the LOGGER::general_log_write(), redundant "if (thd)" check removed, added assert(thd) instead.
[14 Sep 2009 16:03]
Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (version source revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (merge vers: 5.4.4-alpha) (pib:11)
[6 Oct 2009 9:01]
Bugs System
Pushed into 5.1.40 (revid:joro@sun.com-20091006073316-lea2cpijh9r6on7c) (version source revid:ingo.struewing@sun.com-20090916070128-6053el2ucp5z7pyn) (merge vers: 5.1.39) (pib:11)
[7 Oct 2009 0:49]
Paul DuBois
Code cleanup. No changelog entry required.
[18 Dec 2009 10:28]
Bugs System
Pushed into 5.1.41-ndb-7.1.0 (revid:jonas@mysql.com-20091218102229-64tk47xonu3dv6r6) (version source revid:jonas@mysql.com-20091218095730-26gwjidfsdw45dto) (merge vers: 5.1.41-ndb-7.1.0) (pib:15)
[18 Dec 2009 10:44]
Bugs System
Pushed into 5.1.41-ndb-6.2.19 (revid:jonas@mysql.com-20091218100224-vtzr0fahhsuhjsmt) (version source revid:jonas@mysql.com-20091217101452-qwzyaig50w74xmye) (merge vers: 5.1.41-ndb-6.2.19) (pib:15)
[18 Dec 2009 10:59]
Bugs System
Pushed into 5.1.41-ndb-6.3.31 (revid:jonas@mysql.com-20091218100616-75d9tek96o6ob6k0) (version source revid:jonas@mysql.com-20091217154335-290no45qdins5bwo) (merge vers: 5.1.41-ndb-6.3.31) (pib:15)
[18 Dec 2009 11:13]
Bugs System
Pushed into 5.1.41-ndb-7.0.11 (revid:jonas@mysql.com-20091218101303-ga32mrnr15jsa606) (version source revid:jonas@mysql.com-20091218064304-ezreonykd9f4kelk) (merge vers: 5.1.41-ndb-7.0.11) (pib:15)

Description: in ./sql/log.cc we have; bool LOGGER::general_log_write(THD *thd, enum enum_server_command command, const char *query, uint query_length) { ... Security_context *sctx= thd->security_ctx; ... if (thd) id= thd->thread_id; /* Normal thread */ else id= 0; /* Log from connect handler */ ... } if thd was null, it would have segfaulted before the check. the rest of the function goes on to assume thd is never null, this is why this looks wrongly handled. How to repeat: review the code Suggested fix: cleanup the code.