summaryrefslogtreecommitdiff
path: root/ext/Cwd/Cwd.xs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/Cwd/Cwd.xs')
-rw-r--r--ext/Cwd/Cwd.xs6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs
index fae3ef97e3..273ab2d121 100644
--- a/ext/Cwd/Cwd.xs
+++ b/ext/Cwd/Cwd.xs
@@ -424,10 +424,10 @@ PPCODE:
else
croak("Usage: getdcwd(DRIVE)");
- /* Pass a NULL pointer as the second argument to have space allocated. */
- if (dir = _getdcwd(drive, NULL, MAXPATHLEN)) {
+ New(0,dir,MAXPATHLEN,char);
+ if (_getdcwd(drive, dir, MAXPATHLEN)) {
sv_setpvn(TARG, dir, strlen(dir));
- free(dir);
+ Safefree(dir);
SvPOK_only(TARG);
}
else