Skip to content

Commit

Permalink
xenstore: add missing NULL check
Browse files Browse the repository at this point in the history
In case of allocation error, we should not dereference the obtained
NULL pointer. Hence, fail early.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
Reviewed-by: Thomas Friebel <friebelt@amazon.de>
Reviewed-by: Julien Grall <jgrall@amazon.co.uk>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
  • Loading branch information
nmanthey authored and Julien Grall committed Mar 3, 2021
1 parent 4834936 commit 0bdaa8b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/xenstore/xenstored_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,10 @@ static int check_store_(const char *name, struct hashtable *reachable)

struct hashtable * children =
create_hashtable(16, hash_from_key_fn, keys_equal_fn);
if (!children) {
log("check_store create table: ENOMEM");
return ENOMEM;
}

if (!remember_string(reachable, name)) {
hashtable_destroy(children, 0);
Expand Down

0 comments on commit 0bdaa8b

Please sign in to comment.