Doing a malloc(strlen(s)) then a pstrpcp(y, s) is just silly, make it a strdup
authorAndrew Bartlett <abartlet@samba.org>
Wed, 15 Jan 2003 12:48:06 +0000 (12:48 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 15 Jan 2003 12:48:06 +0000 (12:48 +0000)
instead.

Andrew Bartlett
(This used to be commit c781e34d274f4185ec932cc59029d3f9a65e47c4)

source3/lib/util_str.c

index 4d3a808f165d9788c45256a92265c42d63bb0507..148181fdddc018d49cd52cb33faa273a0df50283 100644 (file)
@@ -669,13 +669,11 @@ static BOOL string_init(char **dest,const char *src)
                }
                *dest = null_string;
        } else {
-               (*dest) = (char *)malloc(l+1);
+               (*dest) = strdup(src);
                if ((*dest) == NULL) {
                        DEBUG(0,("Out of memory in string_init\n"));
                        return False;
                }
-
-               pstrcpy(*dest,src);
        }
        return(True);
 }