]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: android: check for null in binder cleanup functions
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 16 Oct 2019 12:23:27 +0000 (14:23 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 16 Oct 2019 12:23:27 +0000 (14:23 +0200)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/android.c

index fefbe38a77563ba93cb55e77d059d88e86c2a1b2..144d462369ea5fbb82cee09dcd95250b8a517f5e 100644 (file)
@@ -358,15 +358,18 @@ static    __attribute__((__constructor__(65535))) void load_symbols(void)
 
 static void cleanup_binder(AIBinder **binder)
 {
-       AIBinder_decStrong(*binder);
+       if (*binder)
+               AIBinder_decStrong(*binder);
 }
 static void cleanup_status(AStatus **status)
 {
-       AStatus_delete(*status);
+       if (*status)
+               AStatus_delete(*status);
 }
 static void cleanup_parcel(AParcel **parcel)
 {
-       AParcel_delete(*parcel);
+       if (*parcel)
+               AParcel_delete(*parcel);
 }
 
 #define _cleanup_status_ __attribute__((__cleanup__(cleanup_status)))