Add support for testing memory allocation failures
The new control interface command TEST_ALLOC_FAIL and GET_ALLOC_FAIL can now be used to trigger memory allocation failures for testing purposes. TEST_ALLOC_FAIL sets a failure conditions with <count>:func[;func][;func]... string and GET_ALLOC_FAIL returns the current state using the same format. Whenever an allocation is made with a matching backtrace of calling functions, the count is decremented by one and once zero is reached, the allocation is forced to fail. Function names can be prefixed with either '=' or '?' to get different matching behavior. '=' requires this specific function to be the next one in the backtrace (i.e., do not skip any other functions in the list which is the default behavior). '?' allows the function to be optionally present in the backtrace. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
52b3943c94
commit
a156ffda61
5 changed files with 231 additions and 0 deletions
|
@ -40,6 +40,7 @@ void wpa_trace_add_ref_func(struct wpa_trace_ref *ref, const void *addr);
|
|||
dl_list_del(&(ptr)->wpa_trace_ref_##name.list); \
|
||||
} while (0)
|
||||
void wpa_trace_check_ref(const void *addr);
|
||||
size_t wpa_trace_calling_func(const char *buf[], size_t len);
|
||||
|
||||
#else /* WPA_TRACE */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue