1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: add extra test for argc==0

Cleaup some compiler warning about posibility to allocate 0 size.
This commit is contained in:
Zdenek Kabelac 2016-06-30 10:27:10 +02:00
parent 458918b319
commit 1e3411aa37

View File

@ -573,6 +573,12 @@ static int clog_ctr(struct dm_ulog_request *rq)
for (argc = 0, p = rq->data; (p = strstr(p, " ")); p++, argc++)
*p = '\0';
if (!argc) {
LOG_ERROR("Received constructor request with bad data %s",
rq->data);
return -EINVAL;
}
argv = malloc(argc * sizeof(char *));
if (!argv)
return -ENOMEM;