chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
65883c9
)
sd-resolve: Allocate objects with new()
author
Daniel Buch
<boogiewasthere@gmail.com>
Sat, 18 Jan 2014 13:30:27 +0000
(14:30 +0100)
committer
Tom Gundersen
<teg@jklm.no>
Sat, 18 Jan 2014 16:52:10 +0000
(17:52 +0100)
src/libsystemd/sd-resolve.c
patch
|
blob
|
history
diff --git
a/src/libsystemd/sd-resolve.c
b/src/libsystemd/sd-resolve.c
index 6958aa9410cc4ef608c47f2fad7cf7acc95e3e6e..7cc8dc4f0ac82aedc12724f97d1daa67cd3bcef8 100644
(file)
--- a/
src/libsystemd/sd-resolve.c
+++ b/
src/libsystemd/sd-resolve.c
@@
-423,7
+423,7
@@
sd_resolve* sd_resolve_new(unsigned n_proc) {
if (n_proc > MAX_WORKERS)
n_proc = MAX_WORKERS;
if (n_proc > MAX_WORKERS)
n_proc = MAX_WORKERS;
- resolve =
malloc(sizeof(sd_resolve)
);
+ resolve =
new(sd_resolve, 1
);
if (!resolve) {
errno = ENOMEM;
goto fail;
if (!resolve) {
errno = ENOMEM;
goto fail;
@@
-562,7
+562,7
@@
static const void *unserialize_addrinfo(const void *p, struct addrinfo **ret_ai,
if (*length < l)
return NULL;
if (*length < l)
return NULL;
- ai =
malloc(sizeof(struct addrinfo)
);
+ ai =
new(struct addrinfo, 1
);
if (!ai)
goto fail;
if (!ai)
goto fail;
@@
-765,7
+765,7
@@
static sd_resolve_query *alloc_query(sd_resolve *resolve) {
resolve->current_index -= MAX_QUERIES;
}
resolve->current_index -= MAX_QUERIES;
}
- q = resolve->queries[resolve->current_index] =
malloc(sizeof(sd_resolve_query)
);
+ q = resolve->queries[resolve->current_index] =
new(sd_resolve_query, 1
);
if (!q) {
errno = ENOMEM;
return NULL;
if (!q) {
errno = ENOMEM;
return NULL;