All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_spaceman: fix potential memory leak by malloc in scan_ag
@ 2017-06-29 15:52 Bill O'Donnell
  2017-06-29 15:59 ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Bill O'Donnell @ 2017-06-29 15:52 UTC (permalink / raw)
  To: linux-xfs; +Cc: sandeen

scan_ag mallocs memory that is potentially leaked. Add a free
to alleviate the potential leak.

Fixes CoverityScan CID#1413772 (RESOURCE_LEAK)

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
 spaceman/freesp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/spaceman/freesp.c b/spaceman/freesp.c
index 22aec821..367c95d1 100644
--- a/spaceman/freesp.c
+++ b/spaceman/freesp.c
@@ -239,7 +239,9 @@ scan_ag(
 			printf(_("%10u %10llu %10llu\n"), agno, freeexts,
 					freeblks);
 	}
+	free(fsmap);
 }
+
 static void
 aglistadd(
 	char		*a)
-- 
2.13.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_spaceman: fix potential memory leak by malloc in scan_ag
  2017-06-29 15:52 [PATCH] xfs_spaceman: fix potential memory leak by malloc in scan_ag Bill O'Donnell
@ 2017-06-29 15:59 ` Darrick J. Wong
  2017-06-29 16:28   ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2017-06-29 15:59 UTC (permalink / raw)
  To: Bill O'Donnell; +Cc: linux-xfs, sandeen

On Thu, Jun 29, 2017 at 10:52:56AM -0500, Bill O'Donnell wrote:
> scan_ag mallocs memory that is potentially leaked. Add a free
> to alleviate the potential leak.
> 
> Fixes CoverityScan CID#1413772 (RESOURCE_LEAK)

/me feels like the coverity tags he's seen tend to take the format of:

    Addresses-Coverity-ID: 1091173
or
    Detected by CoverityScan, CID#1419681 ("Explicit null dereferenced")

though to be honest I don't know that there's really a standard.

<shrug> It probably ought to use one of the two more common formats, but
maybe I can just ask Eric to prettyplease fix it on the way in. :)

> Signed-off-by: Bill O'Donnell <billodo@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  spaceman/freesp.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/spaceman/freesp.c b/spaceman/freesp.c
> index 22aec821..367c95d1 100644
> --- a/spaceman/freesp.c
> +++ b/spaceman/freesp.c
> @@ -239,7 +239,9 @@ scan_ag(
>  			printf(_("%10u %10llu %10llu\n"), agno, freeexts,
>  					freeblks);
>  	}
> +	free(fsmap);
>  }
> +
>  static void
>  aglistadd(
>  	char		*a)
> -- 
> 2.13.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_spaceman: fix potential memory leak by malloc in scan_ag
  2017-06-29 15:59 ` Darrick J. Wong
@ 2017-06-29 16:28   ` Eric Sandeen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2017-06-29 16:28 UTC (permalink / raw)
  To: Darrick J. Wong, Bill O'Donnell; +Cc: linux-xfs



On 6/29/17 10:59 AM, Darrick J. Wong wrote:
> On Thu, Jun 29, 2017 at 10:52:56AM -0500, Bill O'Donnell wrote:
>> scan_ag mallocs memory that is potentially leaked. Add a free
>> to alleviate the potential leak.
>>
>> Fixes CoverityScan CID#1413772 (RESOURCE_LEAK)
> 
> /me feels like the coverity tags he's seen tend to take the format of:
> 
>     Addresses-Coverity-ID: 1091173
> or
>     Detected by CoverityScan, CID#1419681 ("Explicit null dereferenced")
> 
> though to be honest I don't know that there's really a standard.
> 
> <shrug> It probably ought to use one of the two more common formats, but
> maybe I can just ask Eric to prettyplease fix it on the way in. :)

Agreed, will do.

(there are a couple different formats already in the history, but
best not to invent more as we go) :)

-Eric

> 
>> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> 
> Looks ok,
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> --D
> 
>> ---
>>  spaceman/freesp.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/spaceman/freesp.c b/spaceman/freesp.c
>> index 22aec821..367c95d1 100644
>> --- a/spaceman/freesp.c
>> +++ b/spaceman/freesp.c
>> @@ -239,7 +239,9 @@ scan_ag(
>>  			printf(_("%10u %10llu %10llu\n"), agno, freeexts,
>>  					freeblks);
>>  	}
>> +	free(fsmap);
>>  }
>> +
>>  static void
>>  aglistadd(
>>  	char		*a)
>> -- 
>> 2.13.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-29 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 15:52 [PATCH] xfs_spaceman: fix potential memory leak by malloc in scan_ag Bill O'Donnell
2017-06-29 15:59 ` Darrick J. Wong
2017-06-29 16:28   ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.