From 7378278961cb5e40414ead57e64b60fe716a666b Mon Sep 17 00:00:00 2001 From: DanyT Date: Mon, 24 Apr 2023 11:12:35 +0300 Subject: [PATCH] allow apiGroup to be null - allocate and copy the apiGroup only if one is provided - no need for explicit check for null when free is called - free does it --- kubernetes/src/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/src/generic.c b/kubernetes/src/generic.c index 117c5dbf..26dba80a 100644 --- a/kubernetes/src/generic.c +++ b/kubernetes/src/generic.c @@ -5,7 +5,7 @@ genericClient_t* genericClient_create(apiClient_t *client, const char *apiGroup, const char* apiVersion, const char* resourcePlural) { genericClient_t *result = malloc(sizeof(genericClient_t)); result->client = client; - result->apiGroup = strdup(apiGroup); + result->apiGroup = apiGroup ? strdup(apiGroup) : NULL; result->apiVersion = strdup(apiVersion); result->resourcePlural = strdup(resourcePlural);