Minor fixes from blackngel <blackngel1@gmail.com>
diff --git a/debug.c b/debug.c
index d79e173..4353edc 100644
--- a/debug.c
+++ b/debug.c
@@ -87,9 +87,17 @@
xinfdump(long pid, void *ptr, int len) {
int rc;
int i;
- long wrdcnt = len / sizeof(long) + 1;
- long *infwords = malloc(wrdcnt * sizeof(long));
- long addr = (long)ptr;
+ long wrdcnt;
+ long *infwords;
+ long addr;
+
+ wrdcnt = len / sizeof(long) + 1;
+ infwords = malloc(wrdcnt * sizeof(long));
+ if (!infwords) {
+ perror("ltrace: malloc");
+ exit(1);
+ }
+ addr = (long)ptr;
addr = ((addr + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
diff --git a/execute_program.c b/execute_program.c
index e8f801a..360bcd0 100644
--- a/execute_program.c
+++ b/execute_program.c
@@ -85,7 +85,7 @@
execvp(sp->filename, argv);
fprintf(stderr, "Can't execute `%s': %s\n", sp->filename,
strerror(errno));
- exit(1);
+ _exit(1);
}
debug(1, "PID=%d", pid);
diff --git a/read_config_file.c b/read_config_file.c
index 332f390..301b95d 100644
--- a/read_config_file.c
+++ b/read_config_file.c
@@ -647,6 +647,10 @@
}
fun.num_params = i;
fun_p = malloc(sizeof(struct function));
+ if (!fun_p) {
+ perror("ltrace: malloc");
+ exit(1);
+ }
memcpy(fun_p, &fun, sizeof(struct function));
return fun_p;
}