diff options
Diffstat (limited to 'e2fsprogs/blkid/devno.c')
-rw-r--r-- | e2fsprogs/blkid/devno.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/e2fsprogs/blkid/devno.c b/e2fsprogs/blkid/devno.c index 31aa52b..93a57fd 100644 --- a/e2fsprogs/blkid/devno.c +++ b/e2fsprogs/blkid/devno.c @@ -48,11 +48,9 @@ char *blkid_strndup(const char *s, int length) if (!length) length = strlen(s); - ret = malloc(length + 1); - if (ret) { - strncpy(ret, s, length); - ret[length] = '\0'; - } + ret = xmalloc(length + 1); + strncpy(ret, s, length); + ret[length] = '\0'; return ret; } @@ -68,14 +66,8 @@ static void add_to_dirlist(const char *name, struct dir_list **list) { struct dir_list *dp; - dp = malloc(sizeof(struct dir_list)); - if (!dp) - return; + dp = xmalloc(sizeof(struct dir_list)); dp->name = blkid_strdup(name); - if (!dp->name) { - free(dp); - return; - } dp->next = *list; *list = dp; } |