projects
/
external
/
corewatcher.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
db27f39
)
Correct memory management around os-release/version
author
Tim Pepper
<timothy.c.pepper@linux.intel.com>
Thu, 6 Sep 2012 21:56:30 +0000
(14:56 -0700)
committer
Tim Pepper
<timothy.c.pepper@linux.intel.com>
Thu, 6 Sep 2012 21:56:30 +0000
(14:56 -0700)
Valgrind reminded me I should correctly dup the substring and free the
original full string.
Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
src/coredump.c
patch
|
blob
|
history
diff --git
a/src/coredump.c
b/src/coredump.c
index
2fee61f
..
ae9fd75
100644
(file)
--- a/
src/coredump.c
+++ b/
src/coredump.c
@@
-79,10
+79,13
@@
static char *get_release(void)
char *c = NULL;
c = strchr(line, '\n');
- if (c) *c = 0;
-
- fclose(file);
- return &line[11];
+ if (c) {
+ *c = 0;
+ c = strdup(&line[11]);
+ fclose(file);
+ free(line);
+ return c;
+ }
}
}