1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

deviced_id: use zalloc

While moving to dm_strncpy, in this case since pvid is also
passed to crc calc, make sure whole buffer is always initilized.
This commit is contained in:
Zdenek Kabelac 2024-03-29 22:43:06 +01:00
parent 4151df32c1
commit b8d5744c6e

View File

@ -66,8 +66,8 @@ char devices_file_product_uuid_orig[PATH_MAX];
char *strdup_pvid(char *pvid) char *strdup_pvid(char *pvid)
{ {
char *buf; char *buf;
if (!(buf = malloc(ID_LEN + 1))) if (!(buf = zalloc(ID_LEN + 1)))
return NULL; return_NULL;
(void)dm_strncpy(buf, pvid, ID_LEN + 1); (void)dm_strncpy(buf, pvid, ID_LEN + 1);
return buf; return buf;
} }