From ae60cf654a95ac5393fe8dfeeca59f874637af86 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Sun, 24 Mar 2024 11:01:21 +0100 Subject: Use dStrconcat() to concatenate strings Reported-by: dogma --- dpi/file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'dpi/file.c') diff --git a/dpi/file.c b/dpi/file.c index 796f7d6e..5fef5fb9 100644 --- a/dpi/file.c +++ b/dpi/file.c @@ -808,7 +808,7 @@ static char *File_normalize_path(const char *orig) str += 5; /* skip "file:" */ - Dstr *tmp = dStr_sized_new(32); + char *tmp = NULL; if (str[0] == '~' && (str[1] == '/' || str[1] == '\0')) { /* Expand home tilde "~" into "/home/userxyz" */ @@ -818,8 +818,7 @@ static char *File_normalize_path(const char *orig) char *next = str + 1; while (*next == '/') next++; - dStr_sprintf(tmp, "%s%s%s", home, sep, next); - str = tmp->str; + str = tmp = dStrconcat(home, sep, next, NULL); } else if (dStrnAsciiCasecmp(str, "//localhost/", 12) == 0) { /* Skip "//localhost" */ str += 11; @@ -837,7 +836,8 @@ static char *File_normalize_path(const char *orig) basename ? "/" : "", str); dFree(basename); - dStr_free(tmp, 1); + if (tmp) + dFree(tmp); /* Parse possible hexadecimal octets in the URI path */ for (i = 0; ds->str[i]; ++i) { -- cgit v1.2.3