#else
struct termios *term;
- term = malloc(sizeof(struct termios));
+ /* TODO: 'term' is never g_free()'d? */
+ if (!(term = g_try_malloc(sizeof(struct termios)))) {
+ sr_err("serial: %s: term malloc failed", __func__);
+ return NULL;
+ }
+
tcgetattr(fd, term);
return term;
case 115200:
baud = B115200;
break;
+#ifndef __APPLE__
case 460800:
baud = B460800;
break;
+#endif
default:
return SR_ERR;
}