int single_arg = 0;
int do_utc = 0;
+#define FREE(x) do { \
+ free(x); \
+ x = NULL; \
+} while(0)
+
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch (c) {
case 'r': {
}
case 'f': {
single_arg++;
+ FREE(format_string);
format_string = strdup(optarg);
if (format_string == NULL) {
warn("Error allocating memory for format "
}
case 'm': {
single_arg++;
+ FREE(format_string);
format_string = strdup(MIL);
if (format_string == NULL) {
warn("Error allocating memory");
break;
}
case 'T':
+ FREE(timestamp_string);
timestamp_string = strdup(optarg);
if (timestamp_string == NULL) {
warn("Error allocating memory for format "
}
}
+#undef FREE
+
if (action == -1) {
warnx("Must specify an action, either -r or -s");
error = 1;