Message ID | 850f4d8a172c6f41cda02275834028906bfb419c.1464153942.git.riku.voipio@linaro.org |
---|---|
State | Superseded |
Headers | show |
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cec5b80..40e8742 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3167,7 +3167,11 @@ static inline abi_long do_msgrcv(int msqid, abi_long msgp, if (!lock_user_struct(VERIFY_WRITE, target_mb, msgp, 0)) return -TARGET_EFAULT; - host_mb = g_malloc(msgsz+sizeof(long)); + host_mb = g_try_malloc(msgsz + sizeof(long)); + if (!host_mb) { + ret = -TARGET_ENOMEM; + goto end; + } ret = get_errno(msgrcv(msqid, host_mb, msgsz, msgtyp, msgflg)); if (ret > 0) {