Commits

Anonymous committed 47fd0dc

Fix state->max_msg being read and written to within same statement.

  • Participants
  • Parent commits 13887a0

Comments (0)

Files changed (1)

File protobuf-c-text/parse.re

         if (state->current_msg == state->max_msg) {
           ProtobufCMessage **tmp_msgs;
 
+          state->max_msg += 10;
           tmp_msgs = local_realloc(
-              state->msgs, (state->max_msg) * sizeof(ProtobufCMessage *),
-              (state->max_msg += 10) * sizeof(ProtobufCMessage *),
+              state->msgs, (state->current_msg) * sizeof(ProtobufCMessage *),
+              (state->max_msg) * sizeof(ProtobufCMessage *),
               state->allocator);
           if (!tmp_msgs) {
             return state_error(state, t, "Malloc failure.");