spv-driver: Fix memory leak on error path.
[pspp] / src / language / utilities / cd.c
index d28c0a30aa126d4a6b894e2e511a0d3607f21f47..d82ce406a82704bcef689039e04391c5f5f340de 100644 (file)
@@ -34,16 +34,16 @@ cmd_cd (struct lexer *lexer, struct dataset *ds UNUSED)
 {
   char  *path = 0;
 
-  if ( ! lex_force_string (lexer))
+  if (! lex_force_string (lexer))
     goto error;
 
   path = utf8_to_filename (lex_tokcstr (lexer));
 
-  if ( -1 == chdir (path) )
+  if (-1 == chdir (path))
     {
       int err = errno;
-      msg (SE, _("Cannot change directory to %s:  %s "), path,
-          strerror (err));
+      lex_error (lexer, _("Cannot change directory to %s: %s"), path,
+                 strerror (err));
       goto error;
     }