Skip to content

Commit

Permalink
Merge "Fix dereference of null state pointer in ifmap introspect code."
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed May 16, 2015
2 parents 82f5b84 + cbeae29 commit 1059ebe
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/ifmap/ifmap_server_show.cc
Expand Up @@ -360,8 +360,6 @@ void ShowIFMapLinkTable::CopyNode(IFMapLinkShowInfo *dest, DBEntryBase *src,
IFMapServer *server) {
IFMapLink *src_link = static_cast<IFMapLink *>(src);

IFMapLinkState *state = server->exporter()->LinkStateLookup(src_link);

dest->metadata = src_link->metadata();
if (src_link->left()) {
dest->left = src_link->left()->ToString();
Expand All @@ -371,8 +369,13 @@ void ShowIFMapLinkTable::CopyNode(IFMapLinkShowInfo *dest, DBEntryBase *src,
}

// Get the interests and advertised from state
dest->interests = state->interest().ToNumberedString();
dest->advertised = state->advertised().ToNumberedString();
IFMapLinkState *state = server->exporter()->LinkStateLookup(src_link);
if (state) {
dest->interests = state->interest().ToNumberedString();
dest->advertised = state->advertised().ToNumberedString();
} else {
dest->dbentryflags.append("No state, ");
}

if (src_link->IsDeleted()) {
dest->dbentryflags.append("Deleted, ");
Expand Down Expand Up @@ -598,7 +601,7 @@ bool ShowIFMapPerClientNodes::CopyNode(IFMapPerClientNodesShowInfo *dest,
int client_index) {
IFMapNodeState *state = server->exporter()->NodeStateLookup(src);

if (state->interest().test(client_index)) {
if (state && state->interest().test(client_index)) {
dest->node_name = src->ToString();
if (state->advertised().test(client_index)) {
dest->sent = "Yes";
Expand Down Expand Up @@ -774,7 +777,7 @@ bool ShowIFMapPerClientLinkTable::CopyNode(IFMapPerClientLinksShowInfo *dest,
IFMapLink *src, IFMapServer *server, int client_index) {
IFMapLinkState *state = server->exporter()->LinkStateLookup(src);

if (state->interest().test(client_index)) {
if (state && state->interest().test(client_index)) {
dest->metadata = src->metadata();
dest->left = src->left()->ToString();
dest->right = src->right()->ToString();
Expand Down

0 comments on commit 1059ebe

Please sign in to comment.