You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
923 B

  1. commit 4bf6d76a22b9b601fd57df4aa0f4fba62733cb07
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Mon Oct 15 11:08:55 2018 +0200
  4. BUG/MEDIUM: stream: don't crash on out-of-memory
  5. In case pool_alloc() fails in stream_new(), we try to detach the stream
  6. from the list before it has been added, dereferencing a NULL. In order
  7. to fix it, simply move the LIST_DEL call upwards.
  8. This must be backported to 1.8.
  9. (cherry picked from commit e5f229e6392fd54aaba7fe58f457723c16b9d15f)
  10. Signed-off-by: Willy Tarreau <w@1wt.eu>
  11. diff --git a/src/stream.c b/src/stream.c
  12. index 11c9dbf3..ef7cff5c 100644
  13. --- a/src/stream.c
  14. +++ b/src/stream.c
  15. @@ -282,8 +282,8 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin)
  16. out_fail_accept:
  17. flt_stream_release(s, 0);
  18. task_free(t);
  19. - out_fail_alloc:
  20. LIST_DEL(&s->list);
  21. + out_fail_alloc:
  22. pool_free(pool_head_stream, s);
  23. return NULL;
  24. }