[15/16] mem/shmem: Use xmalloc in collect_sysv_shmem

Submitted by Cyrill Gorcunov on July 5, 2019, 3:38 p.m.

Details

Message ID 20190705153811.22652-16-gorcunov@gmail.com
State Accepted
Series "mem: Cleanup and fixups"
Commit 552626190ce58ee054ccfc8b3e6209ea87caac65
Headers show

Commit Message

Cyrill Gorcunov July 5, 2019, 3:38 p.m.
To get error message in log if no memory available.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/shmem.c b/criu/shmem.c
index 478d67a69992..1ca1b89320d2 100644
--- a/criu/shmem.c
+++ b/criu/shmem.c
@@ -234,7 +234,7 @@  int collect_sysv_shmem(unsigned long shmid, unsigned long size)
 	 * Tasks will not modify this object, so don't
 	 * shmalloc() as we do it for anon shared mem
 	 */
-	si = malloc(sizeof(*si));
+	si = xmalloc(sizeof(*si));
 	if (!si)
 		return -1;
 

Comments

Mike Rapoport July 8, 2019, 5:10 p.m.
On Fri, Jul 05, 2019 at 06:38:10PM +0300, Cyrill Gorcunov wrote:
> To get error message in log if no memory available.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>

> ---
>  criu/shmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/criu/shmem.c b/criu/shmem.c
> index 478d67a69992..1ca1b89320d2 100644
> --- a/criu/shmem.c
> +++ b/criu/shmem.c
> @@ -234,7 +234,7 @@ int collect_sysv_shmem(unsigned long shmid, unsigned long size)
>  	 * Tasks will not modify this object, so don't
>  	 * shmalloc() as we do it for anon shared mem
>  	 */
> -	si = malloc(sizeof(*si));
> +	si = xmalloc(sizeof(*si));
>  	if (!si)
>  		return -1;
>  
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
>