Skip to content

Commit 660c84a

Browse files
committed
Check for NULL dbinfo, reset node seq
Signed-off-by: Salil Chandra <schandra107@bloomberg.net>
1 parent b103945 commit 660c84a

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

cdb2api/cdb2api.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5406,11 +5406,12 @@ static int retry_queries(cdb2_hndl_tp *hndl, int num_retry, int run_last)
54065406
CDB2DBINFORESPONSE *dbinfo_response = NULL;
54075407
dbinfo_response =
54085408
cdb2__dbinforesponse__unpack(NULL, len, hndl->first_buf);
5409-
parse_dbresponse(dbinfo_response, hndl->hosts, hndl->ports,
5410-
&hndl->master, &hndl->num_hosts,
5411-
&hndl->num_hosts_sameroom, hndl->debug_trace,
5412-
&hndl->s_sslmode);
5413-
cdb2__dbinforesponse__free_unpacked(dbinfo_response, NULL);
5409+
if (dbinfo_response) {
5410+
parse_dbresponse(dbinfo_response, hndl->hosts, hndl->ports, &hndl->master, &hndl->num_hosts,
5411+
&hndl->num_hosts_sameroom, hndl->debug_trace, &hndl->s_sslmode);
5412+
cdb2__dbinforesponse__free_unpacked(dbinfo_response, NULL);
5413+
hndl->node_seq = 0;
5414+
}
54145415
debugprint("type=%d returning 1\n", type);
54155416

54165417
/* Clear cached SSL sessions - Hosts may have changed. */
@@ -6400,18 +6401,17 @@ static int cdb2_run_statement_typed_int(cdb2_hndl_tp *hndl, const char *sql, int
64006401
GOTO_RETRY_QUERIES();
64016402
}
64026403
/* We got back info about nodes that might be coherent. */
6403-
CDB2DBINFORESPONSE *dbinfo_resp = NULL;
6404-
dbinfo_resp =
6405-
cdb2__dbinforesponse__unpack(NULL, len, hndl->first_buf);
6406-
parse_dbresponse(dbinfo_resp, hndl->hosts, hndl->ports,
6407-
&hndl->master, &hndl->num_hosts,
6408-
&hndl->num_hosts_sameroom, hndl->debug_trace,
6409-
&hndl->s_sslmode);
6410-
cdb2__dbinforesponse__free_unpacked(dbinfo_resp, NULL);
6404+
CDB2DBINFORESPONSE *dbinfo_response = cdb2__dbinforesponse__unpack(NULL, len, hndl->first_buf);
6405+
if (dbinfo_response) {
6406+
parse_dbresponse(dbinfo_response, hndl->hosts, hndl->ports, &hndl->master, &hndl->num_hosts,
6407+
&hndl->num_hosts_sameroom, hndl->debug_trace, &hndl->s_sslmode);
6408+
cdb2__dbinforesponse__free_unpacked(dbinfo_response, NULL);
64116409

6412-
newsql_disconnect(hndl, hndl->sb, __LINE__);
6413-
hndl->connected_host = -1;
6414-
hndl->retry_all = 1;
6410+
newsql_disconnect(hndl, hndl->sb, __LINE__);
6411+
hndl->node_seq = 0;
6412+
hndl->connected_host = -1;
6413+
hndl->retry_all = 1;
6414+
}
64156415

64166416
/* Clear cached SSL sessions - Hosts may have changed. */
64176417
if (hndl->sess != NULL) {

0 commit comments

Comments
 (0)