summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0b852c1)
raw | patch | inline | side by side (parent: 0b852c1)
author | Korynkevych, RomanX <romanx.korynkevych@intel.com> | |
Thu, 12 Jan 2017 11:24:27 +0000 (11:24 +0000) | ||
committer | Korynkevych, RomanX <romanx.korynkevych@intel.com> | |
Fri, 27 Jan 2017 14:15:43 +0000 (14:15 +0000) |
Segmentation fault caused by c_avl_pick() occurs when NULL
iterator is passed.
Change-Id: I3dc960f80b556e18616717ca53fd992c8cf9d78b
Signed-off-by: Korynkevych, RomanX <romanx.korynkevych@intel.com>
iterator is passed.
Change-Id: I3dc960f80b556e18616717ca53fd992c8cf9d78b
Signed-off-by: Korynkevych, RomanX <romanx.korynkevych@intel.com>
src/daemon/utils_avltree.c | patch | blob | history | |
src/snmp_agent.c | patch | blob | history |
index 92259ae19d5ada9c0ea756e548ea59a6e0525c7d..1cf3edfcfdc38eb26d597b2555be9a3b3356e062 100644 (file)
c_avl_node_t *n;
c_avl_node_t *p;
+ assert(t != NULL);
+
if ((key == NULL) || (value == NULL))
return (-1);
if (t->root == NULL)
diff --git a/src/snmp_agent.c b/src/snmp_agent.c
index 74c2d0b027a10f5db5faa8f15828712f1dc2d73e..5f8ed290a199c19530e1b4df8a763f6cb0d5864f 100644 (file)
--- a/src/snmp_agent.c
+++ b/src/snmp_agent.c
/**
* collectd - src/snmp_agent.c
*
- * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * Copyright(c) 2017 Intel Corporation. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
c_avl_destroy((*td)->index_instance);
(*td)->index_instance = NULL;
- while (c_avl_pick((*td)->instance_index, &key, &value) == 0) {
- sfree(key);
- sfree(value);
+ if ((*td)->instance_index != NULL) {
+ while (c_avl_pick((*td)->instance_index, &key, &value) == 0) {
+ sfree(key);
+ sfree(value);
+ }
+ c_avl_destroy((*td)->instance_index);
+ (*td)->instance_index = NULL;
}
- c_avl_destroy((*td)->instance_index);
- (*td)->instance_index = NULL;
sfree((*td)->name);
sfree(*td);