diff options
author | Dmitri Pal <dpal@redhat.com> | 2011-11-17 09:45:06 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-11-17 12:29:11 -0500 |
commit | f5dbb4ecb9bdf991625d5e48d039a66a765b292c (patch) | |
tree | 91f0af0a79648ae74fb5a23ff825bef389f97d5c /collection/collection.c | |
parent | 6e9bffe8cf0070aefa6727bfecab55e1e47db711 (diff) | |
download | ding-libs-f5dbb4ecb9bdf991625d5e48d039a66a765b292c.tar.gz ding-libs-f5dbb4ecb9bdf991625d5e48d039a66a765b292c.tar.xz ding-libs-f5dbb4ecb9bdf991625d5e48d039a66a765b292c.zip |
Fixing dereferencing NULL
This is the issue found by Coverity. If the proprty is NULL
but type is not there is dereferencing of the NULL veriable
in the check.
Diffstat (limited to 'collection/collection.c')
-rw-r--r-- | collection/collection.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/collection/collection.c b/collection/collection.c index 4bee949..1b7762a 100644 --- a/collection/collection.c +++ b/collection/collection.c @@ -1588,11 +1588,13 @@ static int col_find_item_and_do(struct collection_item *ci, /* Make sure that there is anything to search */ type &= COL_TYPE_ANY; - if (((property_to_find == NULL) && (type == 0)) || - ((*property_to_find == '\0') && (type == 0))) { + if ((type == 0) && + ((property_to_find == NULL) || + ((property_to_find != NULL) && (*property_to_find == '\0')))) { TRACE_ERROR_NUMBER("No item search criteria specified - returning error!", ENOENT); return ENOENT; } + /* Prepare data for traversal */ traverse_data = (struct find_name *)malloc(sizeof(struct find_name)); if (traverse_data == NULL) { |