type != PTR_TO_RDWR_BUF &&
                         type != expected_type)
                        goto err_type;
-               meta->raw_mode = arg_type == ARG_PTR_TO_UNINIT_MEM;
        } else if (arg_type_is_alloc_mem_ptr(arg_type)) {
                expected_type = PTR_TO_MEM;
                if (register_is_null(reg) &&
                err = check_helper_mem_access(env, regno,
                                              meta->map_ptr->value_size, false,
                                              meta);
+       } else if (arg_type_is_mem_ptr(arg_type)) {
+               /* The access to this pointer is only checked when we hit the
+                * next is_mem_size argument below.
+                */
+               meta->raw_mode = (arg_type == ARG_PTR_TO_UNINIT_MEM);
        } else if (arg_type_is_mem_size(arg_type)) {
                bool zero_size_allowed = (arg_type == ARG_CONST_SIZE_OR_ZERO);