]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - libblkid/src/dev.c
Merge branch 'fixes' of https://github.com/t-8ch/util-linux
[thirdparty/util-linux.git] / libblkid / src / dev.c
index c38ec3d3213445770a34fded2738a93090d75aa7..ca13f3970df6787f805830f1902d7b91e0b5ac28 100644 (file)
@@ -155,15 +155,13 @@ int blkid_dev_set_search(blkid_dev_iterate iter,
        if (!iter || iter->magic != DEV_ITERATE_MAGIC || !search_type ||
            !search_value)
                return -1;
-       new_type = malloc(strlen(search_type)+1);
-       new_value = malloc(strlen(search_value)+1);
+       new_type = strdup(search_type);
+       new_value = strdup(search_value);
        if (!new_type || !new_value) {
                free(new_type);
                free(new_value);
                return -1;
        }
-       strcpy(new_type, search_type);
-       strcpy(new_value, search_value);
        free(iter->search_type);
        free(iter->search_value);
        iter->search_type = new_type;