ERR("problem in ustcomm_send_request(get_pidunique)");
return NULL;
}
+ if(result == 0) {
+ goto error;
+ }
result = sscanf(received_msg, "%lld", &buf->pidunique);
if(result != 1) {
ERR("problem in ustcomm_send_request(get_shmid)");
return NULL;
}
+ if(result == 0) {
+ goto error;
+ }
result = sscanf(received_msg, "%d %d", &buf->shmid, &buf->bufstruct_shmid);
if(result != 2) {
ERR("problem in ustcomm_send_request(g_n_subbufs)");
return NULL;
}
+ if(result == 0) {
+ goto error;
+ }
result = sscanf(received_msg, "%d", &buf->n_subbufs);
if(result != 1) {
/* get subbuf size */
asprintf(&send_msg, "get_subbuf_size %s", buf->name);
- ustcomm_send_request(&buf->conn, send_msg, &received_msg);
+ result = ustcomm_send_request(&buf->conn, send_msg, &received_msg);
free(send_msg);
+ if(result == -1) {
+ ERR("problem in ustcomm_send_request(get_subbuf_size)");
+ return NULL;
+ }
+ if(result == 0) {
+ goto error;
+ }
result = sscanf(received_msg, "%d", &buf->subbuf_size);
if(result != 1) {
pthread_mutex_unlock(&active_buffers_mutex);
return buf;
+
+error:
+ free(buf);
+ return NULL;
}
int write_current_subbuffer(struct buffer_info *buf)