Skip to content

Commit 711c764

Browse files
Merge pull request #1196 from vojtechtrefny/master_gcc-null-warning-fix
utils: Fail early when calling bd_utils_resolve_device with NULL
2 parents cf292b1 + 578b28a commit 711c764

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/utils/dev_utils.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ gchar* bd_utils_resolve_device (const gchar *dev_spec, GError **error) {
6464
g_autofree gchar *symlink = NULL;
6565
GError *l_error = NULL;
6666

67+
if (dev_spec == NULL) {
68+
g_set_error (error, BD_UTILS_DEV_UTILS_ERROR, BD_UTILS_DEV_UTILS_ERROR_FAILED,
69+
"Device specification required");
70+
return NULL;
71+
}
72+
6773
if (!g_str_has_prefix (dev_spec, "/dev/"))
6874
path = g_strdup_printf ("/dev/%s", dev_spec);
6975
else

0 commit comments

Comments
 (0)