free_command (void *vp, int *error)
{
  struct command *command = vp;
  struct buffer *buffer = command->slice.buffer;

  if (*error) {
    fprintf (stderr, "write at offset %" PRId64 " failed: %s\n",
             command->offset, strerror (*error));
    exit (EXIT_FAILURE);
  }

  if (buffer != NULL) {
    if (--buffer->refs == 0) {
      free (buffer->data);
      free (buffer);
    }
  }

  free (command);

  return 1; /* auto-retires the command */
}
free_command (void *vp, int *error)
{
  struct command *command = vp;
  struct buffer *buffer = command->slice.buffer;

  if (*error) {
    fprintf (stderr, "write at offset %" PRId64 " failed: %s\n",
             command->offset, strerror (*error));
    exit (EXIT_FAILURE);
  }

  if (buffer != NULL) {
    if (--buffer->refs == 0) {
      free (buffer->data);
      free (buffer);
    }
  }

  free (command);

  return 1;  
}