diff --git a/src/extract_gpuinfo_amdgpu.c b/src/extract_gpuinfo_amdgpu.c index d0ff539..5ddb934 100644 --- a/src/extract_gpuinfo_amdgpu.c +++ b/src/extract_gpuinfo_amdgpu.c @@ -497,8 +497,10 @@ static int readAttributeFromDevice(nvtop_device *dev, const char *sysAttr, const va_start(args, format); const char *val; int ret = nvtop_device_get_sysattr_value(dev, sysAttr, &val); - if (ret < 0) + if (ret < 0) { + va_end(args); return ret; + } // Read the pattern int nread = vsscanf(val, format, args); va_end(args);