lecroy-xstream: Fix a potential memory leak.

Reported by scan-build:

  src/hardware/lecroy-xstream/protocol.c:680:12: warning: Potential leak of memory pointed to by 'analog.data'
                                  return SR_ERR;
                                         ^~~~~~
This commit is contained in:
Uwe Hermann 2018-05-19 21:56:07 +02:00
parent 4fc4b8e7aa
commit d5db6ea7e1
1 changed files with 3 additions and 1 deletions

View File

@ -676,9 +676,11 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data)
} else { } else {
/* Update sample rate if needed. */ /* Update sample rate if needed. */
if (state->sample_rate == 0) if (state->sample_rate == 0)
if (lecroy_xstream_update_sample_rate(sdi, analog.num_samples) != SR_OK) if (lecroy_xstream_update_sample_rate(sdi, analog.num_samples) != SR_OK) {
g_free(analog.data);
return SR_ERR; return SR_ERR;
} }
}
/* /*
* Send "frame begin" packet upon reception of data for the * Send "frame begin" packet upon reception of data for the