aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/wtap.h
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2015-08-20 14:38:35 -0400
committerAnders Broman <a.broman58@gmail.com>2015-08-21 04:55:20 +0000
commitfab0e59c70bfd8e39189ac29b17333d85d4645cb (patch)
tree70ebe57fc81481ca1ead1df4067bf547262b4935 /wiretap/wtap.h
parentb4762a043458e5205090282a099184980fb555ea (diff)
Fix memory leaks of dumper SHB and IDB infos
Change-Id: I6b81d3e853d503c6a81f9793957b48ab34c6808c Reviewed-on: https://code.wireshark.org/review/10156 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wiretap/wtap.h')
-rw-r--r--wiretap/wtap.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 4c53b8706c..8de0c30898 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -1736,6 +1736,21 @@ WS_DLL_PUBLIC
wtapng_iface_descriptions_t *wtap_file_get_idb_info(wtap *wth);
/**
+ * @brief Free's a interface description block and all of its members.
+ *
+ * @details This free's all of the interface descriptions inside the passed-in
+ * struct, including their members (e.g., comments); and then free's the
+ * passed-in struct as well.
+ *
+ * @warning Do not use this for the struct returned by
+ * wtap_file_get_idb_info(), as that one did not create the internal
+ * interface descriptions; for that case you can simply g_free() the new
+ * struct.
+ */
+WS_DLL_PUBLIC
+void wtap_free_idb_info(wtapng_iface_descriptions_t *idb_info);
+
+/**
* @brief Gets a debug string of an interface description.
* @details Returns a newly allocated string of debug information about
* the given interface descrption, useful for debugging.
@@ -1847,6 +1862,10 @@ wtap_dumper* wtap_dump_open(const char *filename, int file_type_subtype, int enc
/**
* @brief Opens a new capture file for writing.
*
+ * @note The shb_hdr, idb_inf, and nrb_hdr arguments will be used until
+ * wtap_dump_close() is called, but will not be free'd by the dumper. If
+ * you created them, you must free them yourself after wtap_dump_close().
+ *
* @param filename The new file's name.
* @param file_type_subtype The WTAP_FILE_TYPE_SUBTYPE_XXX file type.
* @param encap The WTAP_ENCAP_XXX encapsulation type (WTAP_ENCAP_PER_PACKET for multi)
@@ -1870,6 +1889,10 @@ wtap_dumper* wtap_dump_fdopen(int fd, int file_type_subtype, int encap, int snap
/**
* @brief Creates a dumper for an existing file descriptor.
*
+ * @note The shb_hdr, idb_inf, and nrb_hdr arguments will be used until
+ * wtap_dump_close() is called, but will not be free'd by the dumper. If
+ * you created them, you must free them yourself after wtap_dump_close().
+ *
* @param file_type_subtype The WTAP_FILE_TYPE_SUBTYPE_XXX file type.
* @param encap The WTAP_ENCAP_XXX encapsulation type (WTAP_ENCAP_PER_PACKET for multi)
* @param snaplen The maximum packet capture length.