Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/usr.sbin/envstat
On Mar 31, 12:00am, Paul Goyette wrote:
}
} > Module Name: src
} > Committed By: christos
} > Date: Thu Dec 13 19:31:25 UTC 2012
} >
} > Modified Files:
} > src/usr.sbin/envstat: envstat.c
}
} > Log Message:
} > PR/47316: Henning Petersen: Memory leak in envstat with config file.
}
} While we're making sure to free() things, should we not also defend
} against memory leaks in the case where an option is used more than once?
}
} RCS file: /cvsroot/src/usr.sbin/envstat/envstat.c,v
} retrieving revision 1.92
} diff -u -p -r1.92 envstat.c
} --- envstat.c 13 Dec 2012 19:31:25 -0000 1.92
} +++ envstat.c 13 Dec 2012 19:47:44 -0000
} @@ -132,6 +132,7 @@ int main(int argc, char **argv)
} while ((c = getopt(argc, argv, "c:Dd:fIi:klrSs:Tw:Wx")) != -1) {
} switch (c) {
} case 'c': /* configuration file */
} + free(configfile);
} configfile = strdup(optarg);
} if (configfile == NULL)
} err(EXIT_FAILURE, "strdup");
If you're going to be this paranoid, you should make sure that
you're not passing NULL to free(3). That can blow up on some systems.
Anyways, I see that Christos has already fixed this in a different way,
so it doesn't really matter.
}-- End of excerpt from Paul Goyette
Home |
Main Index |
Thread Index |
Old Index