navio_sysfs_rc_in: avoid dynamic memory allocation for path

This commit is contained in:
Beat Küng
2016-10-06 09:01:25 +02:00
committed by Lorenz Meier
parent a42f0f5a62
commit b864983c5e
@@ -107,12 +107,11 @@ private:
int RcInput::navio_rc_init()
{
int i;
char *buf;
char buf[64];
for (i = 0; i < _channels; ++i) {
::asprintf(&buf, "%s/ch%d", RCINPUT_DEVICE_PATH_BASE, i);
::snprintf(buf, sizeof(buf), "%s/ch%d", RCINPUT_DEVICE_PATH_BASE, i);
int fd = ::open(buf, O_RDONLY);
::free(buf);
if (fd < 0) {
PX4_WARN("error: open %d failed", i);