Allocate a task wrapper node. fingerprint may be NULL (initial config allows it). * Does not take ownership of cap_task. Returns NULL on allocation failure. */
| 109 | /* Allocate a task wrapper node. fingerprint may be NULL (initial config allows it). |
| 110 | * Does not take ownership of cap_task. Returns NULL on allocation failure. */ |
| 111 | static task_t *task_wrapper_new(int index, const char *fingerprint, capture_task_t *cap_task) |
| 112 | { |
| 113 | task_t *t = calloc(1, sizeof(task_t)); |
| 114 | if (!t) |
| 115 | { |
| 116 | log_error("allocate memory failed"); |
| 117 | return NULL; |
| 118 | } |
| 119 | if (fingerprint) |
| 120 | { |
| 121 | t->fingerprint = strdup(fingerprint); |
| 122 | if (!t->fingerprint) |
| 123 | { |
| 124 | log_error("strdup task fingerprint failed"); |
| 125 | free(t); |
| 126 | return NULL; |
| 127 | } |
| 128 | } |
| 129 | t->index = index; |
| 130 | t->task = cap_task; |
| 131 | return t; |
| 132 | } |
| 133 | |
| 134 | /* Allocate a failed-task record. Returns NULL on allocation failure. */ |
| 135 | static task_error_t *task_error_new(int index, const char *fingerprint, const char *errbuf) |
no outgoing calls
no test coverage detected