Skip to content
  • Blue Swirl's avatar
    Replace qemu_malloc + memset with qemu_mallocz · cc597832
    Blue Swirl authored
    
    
    Replace a qemu_malloc call, followed by a memset, with qemu_mallocz.
    
    Found with this Coccinelle semantic patch, adapted from
    Coccinelle test package rule 94:
    @@
    type T;
    expression x;
    expression E;
    @@
    
    - x = (T)qemu_malloc(E)
    + x = qemu_mallocz(E)
      ...
    (
    - memset(x,0,E);
    |
    - memset(x,0,sizeof(*x));
    )
    
    Some files (tests/*) had to be filtered out.
    
    Signed-off-by: default avatarBlue Swirl <blauwirbel@gmail.com>
    cc597832