Bug in dlz_mysql_driver.c (little one)

"Robin Hack" <[email protected]>
Newsgroups gmane.network.dns.bind9.dlz
Message-ID <[email protected]>
Hello,

I found small bug in dlz_mysql_driver.c in dlz patch which is
contributed with bind-9.4.2 (dlz-v0.7.0).

On line 883 is:
 goto full_cleanup; if build_sqldbinstance(..., &dbi); failed (result
!= ISC_R_SUCCESS)
But when build_sqldbinstance failed (bad query, tokens not found) then
dbi == NULL. After that, calling destroy_sqldbinstance(dbi); on line
949, trigger segmentation fault (tested on linux).

How looks like on gentoo:
29-Apr-2008 09:37:08.198 loading configuration from '/etc/bind/named.conf'
29-Apr-2008 09:37:08.200 no IPv6 interfaces found
29-Apr-2008 09:37:08.200 listening on IPv4 interface lo, 127.0.0.1#53
29-Apr-2008 09:37:08.203 Loading 'Mysql zone' using driver mysql
29-Apr-2008 09:37:08.203 Loading SDLZ driver.
29-Apr-2008 09:37:08.203 Required token %zone% not found.
29-Apr-2008 09:37:08.203 Could not build all nodes query list
29-Apr-2008 09:37:08.203 mysql driver could not create database instance
object.
/lib/rcscripts/sh/rc-daemon.sh: line 231:  2806 Segmentation fault
(core dumped) /sbin/start-stop-daemon '--start' '--quiet' '--pidfile'
'/var/run/named/named.pid' '--nicelevel' '0' '--exec' '/usr/sbin/named'
'--' '-u' 'named' '-g' '-d' '2'

Solution (like in dlz_postgres_driver.c):

if (dbi != NULL)
	destroy_sqldbinstance(dbi);

Bye
Robin Hack

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.