Thomas Huth <th...@linux.vnet.ibm.com> writes:

> On Tue, 27 Jan 2015 17:38:28 +0100
> Markus Armbruster <arm...@redhat.com> wrote:
>
>> Signed-off-by: Markus Armbruster <arm...@redhat.com>
>> ---
>>  kvm-all.c | 4 ----
>>  1 file changed, 4 deletions(-)
>> 
>> diff --git a/kvm-all.c b/kvm-all.c
>> index 2f21a4e..05a79c2 100644
>> --- a/kvm-all.c
>> +++ b/kvm-all.c
>> @@ -2070,10 +2070,6 @@ int kvm_insert_breakpoint(CPUState *cpu, target_ulong 
>> addr,
>>          }
>> 
>>          bp = g_malloc(sizeof(struct kvm_sw_breakpoint));
>> -        if (!bp) {
>> -            return -ENOMEM;
>> -        }
>> -
>>          bp->pc = addr;
>>          bp->use_count = 1;
>>          err = kvm_arch_insert_sw_breakpoint(cpu, bp);
>
> I think I'd also use g_try_malloc() here instead. Looks like an error
> gets reported to GDB when this function returns with an error code, so
> returning -ENOMEM should be ok here, shouldn't it?

Same rationale as for PATCH 2.  sizeof(struct kvm_sw_breakpoint) is 40
bytes on my system.

Reply via email to