In main func of kpartx.c, we should check return value of malloc before using it. Signed-off-by: Zhiqiang Liu <liuzhiqiang26@xxxxxxxxxx> Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx> --- kpartx/kpartx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c index 98f6176e..2f6dea7c 100644 --- a/kpartx/kpartx.c +++ b/kpartx/kpartx.c @@ -384,6 +384,10 @@ main(int argc, char **argv){ if (delim == NULL) { delim = malloc(DELIM_SIZE); + if (!delim) { + fprintf(stderr, "malloc delim failed.\n"); + exit(1); + } memset(delim, 0, DELIM_SIZE); set_delimiter(mapname, delim); } -- -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel