use malloc instead of xmalloc

This commit is contained in:
Mike Frysinger
2005-06-11 22:37:25 +00:00
parent d1a9d57bd6
commit 7fde8debc4
6 changed files with 29 additions and 53 deletions

View File

@@ -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;
}