mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
New API: yara_destroy
The yara_destroy API allows to claim resources back via the removal of the previously loaded Yara rules. Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
This commit is contained in:
committed by
Richard W.M. Jones
parent
27f175b717
commit
09bab5d38c
@@ -111,6 +111,20 @@ do_yara_load (void)
|
||||
return (r == ERROR_SUCCESS) ? 0 : -1;
|
||||
}
|
||||
|
||||
int
|
||||
do_yara_destroy (void)
|
||||
{
|
||||
if (rules == NULL) {
|
||||
reply_with_error ("no yara rules loaded");
|
||||
return -1;
|
||||
}
|
||||
|
||||
yr_rules_destroy (rules);
|
||||
rules = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compile source code rules and load them.
|
||||
* Return ERROR_SUCCESS on success, Yara error code type on error.
|
||||
*/
|
||||
|
||||
@@ -45,4 +45,12 @@ it is recommended to compile them first.
|
||||
|
||||
Previously loaded rules will be destroyed." };
|
||||
|
||||
{ defaults with
|
||||
name = "yara_destroy"; added = (1, 37, 13);
|
||||
style = RErr, [], [];
|
||||
optional = Some "libyara";
|
||||
shortdesc = "destroy previously loaded yara rules";
|
||||
longdesc = "\
|
||||
Destroy previously loaded Yara rules in order to free libguestfs resources." };
|
||||
|
||||
]
|
||||
|
||||
@@ -480,6 +480,7 @@ let proc_nr = [
|
||||
470, "internal_find_inode";
|
||||
471, "mksquashfs";
|
||||
472, "yara_load";
|
||||
473, "yara_destroy";
|
||||
]
|
||||
|
||||
(* End of list. If adding a new entry, add it at the end of the list
|
||||
|
||||
@@ -1 +1 @@
|
||||
472
|
||||
473
|
||||
|
||||
Reference in New Issue
Block a user