On 06/03/2013 08:25 AM, Tommi Rantala wrote:
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?
True, thanks for catching! Not sure if we want to proceed with this patch or put it
on hold for now? Let me know, if wished, I could send an update.
--
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