Skip to content

Commit f36ec11

Browse files
committed
Fix memory leak when calloc() fails in php_readline_completion_cb()
1 parent 910aeaa commit f36ec11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/readline/readline.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,14 @@ char **php_readline_completion_cb(const char *text, int start, int end)
458458
/* libedit will read matches[2] */
459459
matches = calloc(3, sizeof(char *));
460460
if (!matches) {
461-
return NULL;
461+
goto out;
462462
}
463463
matches[0] = strdup("");
464464
}
465465
}
466466
}
467467

468+
out:
468469
zval_ptr_dtor(&params[0]);
469470
zval_ptr_dtor(&_readline_array);
470471

0 commit comments

Comments
 (0)