mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
util_list: Use util_malloc() for util_list_new()
Since now util_list_new() internally fails for out-of-memory situations, we can also remove some NULL pointer checks. Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is contained in:
+2
-3
@@ -13,6 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lib/util_libc.h"
|
||||
#include "lib/util_list.h"
|
||||
|
||||
/*
|
||||
@@ -45,10 +46,8 @@ void util_list_init_offset(struct util_list *list, unsigned long offset)
|
||||
*/
|
||||
struct util_list *util_list_new_offset(unsigned long offset)
|
||||
{
|
||||
struct util_list *list = malloc(sizeof(*list));
|
||||
struct util_list *list = util_malloc(sizeof(*list));
|
||||
|
||||
if (!list)
|
||||
return NULL;
|
||||
util_list_init_offset(list, offset);
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user