diff options
author | Matthew Booth <mbooth@redhat.com> | 2009-09-11 10:33:32 +0100 |
---|---|---|
committer | Matthew Booth <mbooth@redhat.com> | 2009-09-11 17:18:18 +0100 |
commit | 02ae70474d418b202b6a8411daa54f8dfc790206 (patch) | |
tree | 58c7d3b6fe99ce9f4ba53e69e8f46d9913506a46 /src | |
parent | 006873b92da9d0a5c7d9008bd94caabe0028e4c0 (diff) | |
download | libguestfs-02ae70474d418b202b6a8411daa54f8dfc790206.tar.gz libguestfs-02ae70474d418b202b6a8411daa54f8dfc790206.tar.xz libguestfs-02ae70474d418b202b6a8411daa54f8dfc790206.zip |
generator.ml: Fix string list memory leak
Parsed string lists are allocated by malloc, but were never freed.
Diffstat (limited to 'src')
-rwxr-xr-x | src/generator.ml | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/generator.ml b/src/generator.ml index 2e2b70e5..433c60ad 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -6221,7 +6221,7 @@ and generate_fish_cmds () = | OptString n | FileIn n | FileOut n -> pr " const char *%s;\n" n - | StringList n | DeviceList n -> pr " char *const *%s;\n" n + | StringList n | DeviceList n -> pr " char **%s;\n" n | Bool n -> pr " int %s;\n" n | Int n -> pr " int %s;\n" n ) (snd style); @@ -6264,6 +6264,15 @@ and generate_fish_cmds () = generate_c_call_args ~handle:"g" style; pr ";\n"; + List.iter ( + function + | Pathname name | Device name | Dev_or_Path name | String name + | OptString name | FileIn name | FileOut name | Bool name + | Int name -> () + | StringList name | DeviceList name -> + pr " free_strings (%s);\n" name + ) (snd style); + (* Check return value for errors and display command results. *) (match fst style with | RErr -> pr " return r;\n" |