libcap/libcap-invalid-free-fix.diff

35 lines
979 B
Diff

--- progs/getpcaps.c-dist 1999-11-18 07:04:25.000000000 +0100
+++ progs/getpcaps.c 2006-12-19 17:51:31.000000000 +0100
@@ -52,9 +52,11 @@ int main(int argc, char **argv)
continue;
} else {
char *result = cap_to_text(cap_d, &length);
- fprintf(stderr, "Capabilities for `%s': %s\n", *argv, result);
- cap_free(result);
- result = NULL;
+ if (result) {
+ fprintf(stderr, "Capabilities for `%s': %s\n", *argv, result);
+ cap_free(result);
+ result = NULL;
+ }
}
}
--- progs/setpcaps.c-dist 1999-11-18 07:04:26.000000000 +0100
+++ progs/setpcaps.c 2006-12-19 17:51:57.000000000 +0100
@@ -100,9 +100,11 @@ int main(int argc, char **argv)
char *result;
result = cap_to_text(cap_d, &length);
- fprintf(stderr, "[caps set to:\n%s\n]\n", result);
- cap_free(result);
- result = NULL;
+ if (result) {
+ fprintf(stderr, "[caps set to:\n%s\n]\n", result);
+ cap_free(result);
+ result = NULL;
+ }
}
#endif