r=Adilger
Fix a memory leak.
if (verbose)
fprintf(stderr,"warning: device %s does not match any "
"entry under /sys/block\n", real_path);
- return -EINVAL;
+ rc = -EINVAL;
+ goto out;
}
snprintf(path, sizeof(path), "%s/%s", glob_info.gl_pathv[i],
if (verbose)
fprintf(stderr, "warning: opening %s: %s\n",
path, strerror(errno));
- return rc;
+ goto out;
}
if (strlen(buf) - 1 > 0) {
fprintf(stderr, "warning: writing to %s: %s\n",
path, strerror(errno));
}
+
+out:
+ globfree(&glob_info);
return rc;
}