* [PATCH] tools/libxl: cleanup one libxl__calloc() usage
@ 2015-03-10 6:28 Tiejun Chen
2015-03-10 9:21 ` Wei Liu
0 siblings, 1 reply; 3+ messages in thread
From: Tiejun Chen @ 2015-03-10 6:28 UTC (permalink / raw)
To: wei.liu2, ian.campbell, stefano.stabellini, ian.jackson; +Cc: xen-devel
Its pointless because internally, libxl__calloc() would always
terminate program execution if failed,
libxl__calloc()
|
+ void *ptr = calloc(nmemb, size);
+ if (!ptr) libxl__alloc_failed(CTX, __func__, nmemb, size);
|
+ _exit(-1);
Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
tools/libxl/libxl_dm.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 8599a6a..cb006df 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1175,10 +1175,6 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
num_console++;
console = libxl__calloc(gc, num_console, sizeof(libxl__device_console));
- if (!console) {
- ret = ERROR_NOMEM;
- goto out;
- }
for (i = 0; i < num_console; i++) {
libxl__device device;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] tools/libxl: cleanup one libxl__calloc() usage
2015-03-10 6:28 [PATCH] tools/libxl: cleanup one libxl__calloc() usage Tiejun Chen
@ 2015-03-10 9:21 ` Wei Liu
2015-03-11 12:30 ` Ian Campbell
0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2015-03-10 9:21 UTC (permalink / raw)
To: Tiejun Chen
Cc: ian.jackson, xen-devel, wei.liu2, ian.campbell,
stefano.stabellini
On Tue, Mar 10, 2015 at 02:28:16PM +0800, Tiejun Chen wrote:
> Its pointless because internally, libxl__calloc() would always
> terminate program execution if failed,
>
> libxl__calloc()
> |
> + void *ptr = calloc(nmemb, size);
> + if (!ptr) libxl__alloc_failed(CTX, __func__, nmemb, size);
> |
> + _exit(-1);
>
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
> ---
> tools/libxl/libxl_dm.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index 8599a6a..cb006df 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -1175,10 +1175,6 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
> num_console++;
>
> console = libxl__calloc(gc, num_console, sizeof(libxl__device_console));
> - if (!console) {
> - ret = ERROR_NOMEM;
> - goto out;
> - }
>
> for (i = 0; i < num_console; i++) {
> libxl__device device;
> --
> 1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] tools/libxl: cleanup one libxl__calloc() usage
2015-03-10 9:21 ` Wei Liu
@ 2015-03-11 12:30 ` Ian Campbell
0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2015-03-11 12:30 UTC (permalink / raw)
To: Wei Liu; +Cc: Tiejun Chen, xen-devel, ian.jackson, stefano.stabellini
On Tue, 2015-03-10 at 09:21 +0000, Wei Liu wrote:
> On Tue, Mar 10, 2015 at 02:28:16PM +0800, Tiejun Chen wrote:
> > Its pointless because internally, libxl__calloc() would always
> > terminate program execution if failed,
> >
> > libxl__calloc()
> > |
> > + void *ptr = calloc(nmemb, size);
> > + if (!ptr) libxl__alloc_failed(CTX, __func__, nmemb, size);
> > |
> > + _exit(-1);
> >
> > Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
>
> Acked-by: Wei Liu <wei.liu2@citrix.com>
Likewise + applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-11 12:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-10 6:28 [PATCH] tools/libxl: cleanup one libxl__calloc() usage Tiejun Chen
2015-03-10 9:21 ` Wei Liu
2015-03-11 12:30 ` Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.