X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnut.c;h=997d1a50ed838336e8f10026fa416dad4964ef06;hb=67b77875fa96f683987d639b29437bfbf941c4f6;hp=1d1e94b521cc9fdd02a19e58e828ba2c182d3795;hpb=a0412f28fc15eb04a9a630678a97b6bce2d71fb1;p=collectd.git diff --git a/src/nut.c b/src/nut.c index 1d1e94b5..997d1a50 100644 --- a/src/nut.c +++ b/src/nut.c @@ -144,8 +144,7 @@ static int nut_verify_peer(const char *value) { static int nut_ca_path(const char *value) { if (value != NULL && strcmp(value, "") != 0) { - ca_path = malloc(strlen(value) + 1); - strncpy(ca_path, value, (strlen(value) + 1)); + ca_path = strdup(value); } else { ca_path = NULL; // Should alread be set to NULL from initialization }