X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=programs%2Fimagex.c;h=dd1a1243900cff33ebf44859139da74fa083c8fa;hp=c3ab4b737f08732adc534c2ee30f38da240720dd;hb=590fbf5626965d44f924be5cc8b04eb489f69f25;hpb=782d531f37b8548e8b28d28bc8e4e07d6be41944 diff --git a/programs/imagex.c b/programs/imagex.c index c3ab4b73..dd1a1243 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -551,7 +551,9 @@ parse_source_list(tchar **source_list_contents_p, size_t source_list_nchars, nlines++; } - sources = calloc(nlines, sizeof(*sources)); + /* Always allocate at least 1 slot, just in case the implementation of + * calloc() returns NULL if 0 bytes are requested. */ + sources = calloc(nlines ?: 1, sizeof(*sources)); if (!sources) goto oom; p = source_list_contents;