> just a guess.
> 
> EMC_TASK_SET_STATE *state_msg;
> 
> state_msg is a pointer, yet no memory allocated for it.
> 
> state_msg->state = EMC_TASK_STATE_OFF;
> 
> you try to write in a memory space that officially has no memory assigned yet.
> 
> ju
You are correct no memory assigned. Maybe no warning for using an unitialized 
variable, if turned a warning would be issued for using unitizialized variable.

Memory may be allocated with malloc but unless function 
emcCommandBuffer->write(...) store the pointer internally, copy data internally 
is below might be a much better idea. If state_msg variable is not used further 
down or at least is not supposed the block will also limit life time of 
variable.

{
  EMC_TASK_SET_STATE state_msg;

  state_msg.state = EMC_TASK_STATE_OFF;
  state_msg.serial_number = ++emcCommandSerialNumber;
  emcCommandBuffer->write(&state_msg);
}


_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to