• Binbin's avatar
    Fix crash when overcommit_memory is inaccessible (#10848) · 62ac1ab0
    Binbin authored
    When `/proc/sys/vm/overcommit_memory` is inaccessible, fp is NULL.
    `checkOvercommit` will return -1 without setting err_msg, and then
    the err_msg is used to print the log, crash the server.
    Set the err_msg variables to Null when declaring it, seems safer.
    
    And the overcommit_memory error log will print two "WARNING",
    like `WARNING WARNING overcommit_memory is set to 0!`, this PR
    also removes the second WARNING in `checkOvercommit`.
    
    Reported in #10846. Fixes #10846. Introduced in #10636 (7.0.1)
    62ac1ab0
server.c 268 KB