[PATCH 8/8] confdb: check if find_iter_context returned NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If so, we will return error to library. This shouldn't happen as long as
library user isn't overwriting memory.

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 lib/confdb.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/lib/confdb.c b/lib/confdb.c
index 5d3c536..ce698e5 100644
--- a/lib/confdb.c
+++ b/lib/confdb.c
@@ -712,12 +712,17 @@ cs_error_t confdb_object_find_destroy(
 	}
 
 	context = find_iter_context(&confdb_inst->object_find_head, parent_object_handle);
+	if (context == NULL) {
+		error = CS_ERR_LIBRARY;
+		goto error_exit;
+	}
 	error = do_find_destroy(confdb_inst, context->find_handle);
 	if (error == CS_OK) {
 		list_del(&context->list);
 		free(context);
 	}
 
+error_exit:
 	(void)hdb_handle_put (&confdb_handle_t_db, handle);
 	return error;
 }
@@ -736,12 +741,17 @@ cs_error_t confdb_object_iter_destroy(
 	}
 
 	context = find_iter_context(&confdb_inst->object_iter_head, parent_object_handle);
+	if (context == NULL) {
+		error = CS_ERR_LIBRARY;
+		goto error_exit;
+	}
 	error = do_find_destroy(confdb_inst, context->find_handle);
 	if (error == CS_OK) {
 		list_del(&context->list);
 		free(context);
 	}
 
+error_exit:
 	(void)hdb_handle_put (&confdb_handle_t_db, handle);
 	return error;
 }
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux