Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some memory leaks * generate.c: free the options context allocated at the start of the main function. * openvswitch.c: make sure the GString "cmds" is free'd before the function returns. * parse.c: free the temporary list "values" before the function returns. * parse.c: parsed_defs is set to NULL preventing netplan_parser_reset() to free the memory allocated for the hash table. Not setting it to NULL is safe because all the data is moved to another hash table, leaving parsed_defs with no elements. Not nullifying parsed_defs here allows netplan_parser_reset() to free it. * types.c: in this particular case we g_strdup both key and value strings when inserting them in the hash table in parse.c:handle_generic_map(). Calling the destructor for both of them will make sure all the memory is free'd. When using free_hashtable_with_destructor in the future we'll need to make sure both key and value are not poiting to the same place to avoid a double free. * util.c: release the glob_t allocated in find_yaml_glob(). * error.c: make sure the pointer 'line' is free'd after the last loop iteration. Also, free error_context before returning. * generate.c: free the error object if an error is returned at some point. * parse-nm.c: free "ap" when ssid can't be found (caught by clang build-scan). * parse.c: filepath might be overwritten in some situations. Make sure the old one is free'd. * parse.c: netdef->vxlan might be overwritten in some situations. Make sure the old one is free'd. * types.c: free embedded_switch_mode when the netdef is reset.
- Loading branch information
1 parent
5afb97a
commit 26ea3a6
Showing
7 changed files
with
26 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters