• Mats Kindahl's avatar
    Bug #47645: Segmentation fault when out of memory during handlerton initialization · 5d2f79de
    Mats Kindahl authored
    There is a missing check for memory allocation failure when allocating
    memory for the handlerton structure. If the handlerton init function
    tries to de-reference the pointer, it will cause a segmentation fault
    and crash the server.
    
    This patch fixes the problem by not calling the init function if memory
    allocation failed, and instead prints an informative error message and
    reports the error to the caller.
    
    sql/handler.cc:
      Add a check if memory allocation succeeded before calling the init
      function. If it failed, it is not necessary to free the memory,
      but the plugin->data is set to NULL to ensure that it can be checked
      for failure.
    5d2f79de
handler.cc 140 KB