X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fcommon%2Fserial.c;h=339577630eeeddf26ca472e4696fc8560b15b231;hb=9a751023136a058dadf008a4ff983351947cc0df;hp=5205c188e6b785beeac473ff3e6db9dc0b38b0cc;hpb=8a7b47cdfae4a4a95e92958beab41a4985e8f8e3;p=libsigrok.git diff --git a/hardware/common/serial.c b/hardware/common/serial.c index 5205c188..33957763 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -163,7 +163,12 @@ void *serial_backup_params(int fd) #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; @@ -243,9 +248,11 @@ int serial_set_params(int fd, int speed, int bits, int parity, int stopbits, case 115200: baud = B115200; break; +#ifndef __APPLE__ case 460800: baud = B460800; break; +#endif default: return SR_ERR; }