Allocate a failed-task record. Returns NULL on allocation failure. */
| 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) |
| 136 | { |
| 137 | task_error_t *e = calloc(1, sizeof(task_error_t)); |
| 138 | if (!e) |
| 139 | { |
| 140 | log_error("allocate memory failed"); |
| 141 | return NULL; |
| 142 | } |
| 143 | if (fingerprint) |
| 144 | { |
| 145 | e->fingerprint = strdup(fingerprint); |
| 146 | if (!e->fingerprint) |
| 147 | { |
| 148 | log_error("strdup error fingerprint failed"); |
| 149 | free_task_error(e); |
| 150 | return NULL; |
| 151 | } |
| 152 | } |
| 153 | e->index = index; |
| 154 | strncpy(e->errbuf, errbuf, ERROR_BUFFER_SIZE); |
| 155 | return e; |
| 156 | } |
| 157 | |
| 158 | typedef struct TaskStatsSummarySnapshot |
| 159 | { |
no test coverage detected