Hi!

>>>>> "Sergey" == Sergey Petrunya <[email protected]> writes:

<cut>

Sergey> Log_event* Log_event::read_log_event(IO_CACHE* file,
Sergey>                                      const Format_description_log_event
Sergey>                                      *description_event)

Sergey> which has this code:
Sergey>   // some events use the extra byte to null-terminate strings
Sergey>   if (!(buf = (char*) my_malloc(data_len+1, MYF(MY_WME))))
Sergey>   {
Sergey>     error = "Out of memory";
Sergey>     goto err;
Sergey>   }
Sergey>   buf[data_len] = 0;
Sergey>   memcpy(buf, head, header_size);

Short note:

You can replace all of the above with:

if (!(buf= (char*) my_strndup(head, header_size, MYF(MY_WME))))
  goto err;

Note that my_strndup() when used with the MY_WME flag will generate an
error message itself!

<cut>

Regards,
Monty

_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to