diff --git a/src/lib66/instance/instance_check.c b/src/lib66/instance/instance_check.c index f01ce8c7bc0c1216aebc3d5223f14f0254f97b6c..024bc999ed8c56c60681f9fb1d041ea02b145d01 100644 --- a/src/lib66/instance/instance_check.c +++ b/src/lib66/instance/instance_check.c @@ -23,7 +23,7 @@ int instance_check(char const *svname) { log_flow() ; - int r ; + int r = 0 ; r = get_len_until(svname,'@') ; // avoid empty value after the instance template name if (strlen(svname+r) <= 1 && r > 0) return 0 ; diff --git a/src/lib66/instance/instance_create.c b/src/lib66/instance/instance_create.c index a4534a56aafaa8e7a748b50b85474813b61257fc..5a36adebe2ab5982bd78397d99b6059ea184302b 100644 --- a/src/lib66/instance/instance_create.c +++ b/src/lib66/instance/instance_create.c @@ -26,6 +26,7 @@ int instance_create(stralloc *sasv,char const *svname, char const *regex, int le { log_flow() ; + int e = 0 ; char const *copy ; size_t tlen = len + 1 ; @@ -39,11 +40,16 @@ int instance_create(stralloc *sasv,char const *svname, char const *regex, int le log_warnu("replace instance character for service: ",svname) ; goto err ; } - if (!stralloc_copy(sasv,&tmp)) goto err ; - stralloc_free(&tmp) ; - return 1 ; + stralloc_0(&tmp) ; + + sasv->len = 0 ; + + if (!auto_stra(sasv, tmp.s)) + goto err ; + + e = 1 ; err: stralloc_free(&tmp) ; - return 0 ; + return e ; }