Skip to content

Commit c2b0be5

Browse files
committed
Fix memory leak in posix_ttyname()
Closes GH-10190
1 parent 3a44c78 commit c2b0be5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ PHP NEWS
3131
. Fix undefined behaviour in phpdbg_load_module_or_extension(). (nielsdos)
3232
. Fix NULL pointer dereference in phpdbg_create_conditional_breal(). (nielsdos)
3333

34+
- Posix:
35+
. Fix memory leak in posix_ttyname() (girgias)
36+
3437
- TSRM:
3538
. Fixed Windows shmget() wrt. IPC_PRIVATE. (Tyson Andre)
3639

ext/posix/posix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,15 +547,15 @@ PHP_FUNCTION(posix_ttyname)
547547
efree(p);
548548
RETURN_FALSE;
549549
}
550-
RETURN_STRING(p);
550+
RETVAL_STRING(p);
551551
efree(p);
552552
#else
553553
if (NULL == (p = ttyname(fd))) {
554554
POSIX_G(last_error) = errno;
555555
RETURN_FALSE;
556556
}
557-
#endif
558557
RETURN_STRING(p);
558+
#endif
559559
}
560560
/* }}} */
561561

0 commit comments

Comments
 (0)