* Alloc a file object of given size. * Returns NULL on error. */
| 294 | * Returns NULL on error. |
| 295 | */ |
| 296 | static struct fileobject *malloc_fo(const size_t size) |
| 297 | { |
| 298 | struct fileobject *fo; |
| 299 | if (!size) |
| 300 | return NULL; |
| 301 | |
| 302 | fo = malloc(sizeof(*fo)); |
| 303 | if (!fo) |
| 304 | return NULL; |
| 305 | fo->data = malloc(size); |
| 306 | if (!fo->data) { |
| 307 | free(fo); |
| 308 | return NULL; |
| 309 | } |
| 310 | fo->size = size; |
| 311 | |
| 312 | return fo; |
| 313 | } |
| 314 | |
| 315 | /* Free a fileobject structure */ |
| 316 | static void free_fo(struct fileobject *fo) |
no test coverage detected