[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2013/5/26 Daniel Borkmann <dborkman@xxxxxxxxxx>:
> diff --git a/devices.c b/devices.c
> index 0493c39..2e115f8 100644
> --- a/devices.c
> +++ b/devices.c
> @@ -8,6 +8,7 @@
>  #include <sys/types.h>
>  #include <linux/kdev_t.h>
>
> +#include "trinity.h"
>  #include "log.h"
>
>  static struct {
> @@ -37,9 +38,9 @@ static void parse_proc_devices(void)
>                         block = 1;
>                 else if (sscanf(line, "%d %as", &major, &name) == 2) {
>                         if (block) {
> -                               new = realloc(block_devs, (bldevs+1)*sizeof(*block_devs));
> +                               new = bdw_realloc(block_devs, (bldevs+1)*sizeof(*block_devs));
>                                 if (!new) {
> -                                       free(name);
> +                                       bdw_free(name);
>                                         continue;
>                                 }
>                                 block_devs = new;
> @@ -48,9 +49,9 @@ static void parse_proc_devices(void)
>                                 block_devs[bldevs].name = name;
>                                 bldevs++;
>                         } else {
> -                               new = realloc(char_devs, (chrdevs+1)*sizeof(*char_devs));
> +                               new = bdw_realloc(char_devs, (chrdevs+1)*sizeof(*char_devs));
>                                 if (!new) {
> -                                       free(name);
> +                                       bdw_free(name);
>                                         continue;
>                                 }
>                                 char_devs = new;
> @@ -63,7 +64,7 @@ static void parse_proc_devices(void)
>         }
>
>         fclose(fp);
> -       free(line);
> +       bdw_free(line);
>  }

'line' is allocated implicitly by getline(), is it safe to bdw_free() it?

Tommi
--
To unsubscribe from this list: send the line "unsubscribe trinity" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux