Three more pstring removals.
[tprouty/samba.git] / source3 / smbd / chgpasswd.c
index d89442150fa65cb46a707f291154afc9f8d3cab9..6e7ef208c1c915a7cb25a90644ab18b65806d54c 100644 (file)
@@ -262,14 +262,18 @@ static int expect(int master, char *issue, char *expected)
 
                        {
                                /* Eat leading/trailing whitespace before match. */
-                               pstring str;
-                               pstrcpy( str, buffer);
-                               trim_char( str, ' ', ' ');
+                               char *str = SMB_STRDUP(buffer);
+                               if (!str) {
+                                       DEBUG(2,("expect: ENOMEM\n"));
+                                       return False;
+                               }
+                               trim_char(str, ' ', ' ');
 
                                if ((match = unix_wild_match(expected, str)) == True) {
                                        /* Now data has started to return, lower timeout. */
                                        timeout = lp_passwd_chat_timeout() * 100;
                                }
+                               SAFE_FREE(str);
                        }
                }