diff --git a/vapi/bzlib.vapi b/vapi/bzlib.vapi
index 844442dd8..eef711576 100644
--- a/vapi/bzlib.vapi
+++ b/vapi/bzlib.vapi
@@ -46,6 +46,12 @@ namespace BZLib {
                CONFIG_ERROR
        }
 
+       [CCode (cname = "void*(*)(void*,int,int)", has_target = false)]
+       public delegate void *AllocFunc (void *target, int m, int n);
+
+       [CCode (cname = "void(*)(void*,void*)", has_target = false)]
+       public delegate void FreeFunc (void *target, void *p);
+
        [CCode (cname = "bz_stream", has_type_id = false)]
        public struct Stream {
                public string next_in;
@@ -57,6 +63,8 @@ namespace BZLib {
                public uint totoal_out_lo32;
                public uint total_out_hi32;
                public void *state;
+               public AllocFunc? bzalloc;
+               public FreeFunc? bzfree;
                public void *opaque;
                [CCode (cname = "BZ2_bzCompressInit")]
                public Status compress_init (int block_size_100k, int verbosity, int work_factor);