daemon: Ensure CLEANUP_FREE* variables are initialized with NULL.

Otherwise an early exit from the function will cause an uninitialized
pointer to be freed.

This fixes commit 1d7c3a2782.
This commit is contained in:
Richard W.M. Jones
2013-08-11 23:37:17 +01:00
parent 858d6e7176
commit 29d8658311

View File

@@ -249,7 +249,7 @@ cleanup_free_mountable (mountable_t *mountable)
List.iter (
function
| Device n | Dev_or_Path n ->
pr " CLEANUP_FREE char *%s;\n" n
pr " CLEANUP_FREE char *%s = NULL;\n" n
| Pathname n | String n | Key n | OptString n ->
pr " const char *%s;\n" n
| Mountable n | Mountable_or_Path n ->
@@ -258,7 +258,7 @@ cleanup_free_mountable (mountable_t *mountable)
| StringList n ->
pr " char **%s;\n" n
| DeviceList n ->
pr " CLEANUP_FREE_STRING_LIST char **%s;\n" n
pr " CLEANUP_FREE_STRING_LIST char **%s = NULL;\n" n
| Bool n -> pr " int %s;\n" n
| Int n -> pr " int %s;\n" n
| Int64 n -> pr " int64_t %s;\n" n