These are used to protect a free(file->memory), within their respective
unload functions. Where the sole caller of the unload function already
does a NULL check prior.
Even so, free(NULL) is guaranteed to be safe by the standard.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
};
struct kmod_file {
-#ifdef ENABLE_ZSTD
- bool zstd_used;
-#endif
-#ifdef ENABLE_XZ
- bool xz_used;
-#endif
int fd;
enum kmod_file_compression_type compression;
off_t size;
ZSTD_freeDStream(dstr);
free((void *)zst_inb.src);
- file->zstd_used = true;
file->memory = zst_outb.dst;
file->size = zst_outb.pos;
return 0;
static void unload_zstd(struct kmod_file *file)
{
- if (!file->zstd_used)
- return;
free(file->memory);
}
goto out;
}
}
- file->xz_used = true;
file->memory = p;
file->size = total;
return 0;
static void unload_xz(struct kmod_file *file)
{
- if (!file->xz_used)
- return;
free(file->memory);
}