Added a check for malloc fail.

Eventually we need to add a whole bunch more of these.
This commit is contained in:
Jef Poskanzer 2013-12-12 08:15:15 -08:00
parent b70c54055f
commit c8a0a2229d

View File

@ -1363,6 +1363,11 @@ iperf_new_test()
memset(test, 0, sizeof(struct iperf_test));
test->settings = (struct iperf_settings *) malloc(sizeof(struct iperf_settings));
if (!test->settings) {
free(test);
i_errno = IENEWTEST;
return NULL;
}
memset(test->settings, 0, sizeof(struct iperf_settings));
return test;