channels/drive: Fix leak found by covscan
authorOndrej Holy <oholy@redhat.com>
Fri, 17 Aug 2018 10:43:49 +0000 (12:43 +0200)
committerOndrej Holy <oholy@redhat.com>
Wed, 22 Aug 2018 11:35:43 +0000 (13:35 +0200)
leaked_storage: Variable "outStr" going out of scope leaks the storage it points to.

channels/drive/client/drive_main.c

index 10ebbbd..d6bfd6d 100644 (file)
@@ -527,6 +527,7 @@ static UINT drive_process_irp_query_volume_information(DRIVE_DEVICE* drive,
 
                        if (!Stream_EnsureRemainingCapacity(output, 12 + length))
                        {
+                               free(outStr);
                                WLog_ERR(TAG, "Stream_EnsureRemainingCapacity failed!");
                                return CHANNEL_RC_NO_MEMORY;
                        }