Ack,
Mathi.

> -----Original Message-----
> From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> Sent: Monday, May 23, 2016 1:17 PM
> To: Mathivanan Naickan Palanivelu; Lennart Lund
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] log: fix memory leaked after performing admin-op
> [#1844]
> 
>  osaf/services/saf/logsv/lgs/lgs_imm.cc |  7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> 
> logsv calls immutil_get_className() to get className, and that function
> returns an pointer to an allocated memory (strdup).
> 
> So, the `className` must be freed after done using.
> 
> diff --git a/osaf/services/saf/logsv/lgs/lgs_imm.cc
> b/osaf/services/saf/logsv/lgs/lgs_imm.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_imm.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_imm.cc
> @@ -390,6 +390,10 @@ static void adminOperationCallback(SaImm
> 
>       if (opId == SA_LOG_ADMIN_CHANGE_FILTER) {
>               /* Only allowed to update runtime objects (application
> streams) */
> +             /**
> +              * className holds a pointer to an duplicated memory
> (strdup).
> +              * Must be free after done using.
> +              */
>               SaImmClassNameT className =
> immutil_get_className(objectName);
> 
>               if (!strcmp(className, "SaLogStreamConfig")) { @@ -399,8
> +403,11 @@ static void adminOperationCallback(SaImm
> 
>       LOG_ER("immutil_saImmOiAdminOperationResult failed %s",
> saf_error(ais_rc));
>                               osaf_abort(0);
>                       }
> +
> +                     free(className);
>                       goto done;
>               }
> +             free(className);
> 
>               if (stream->streamType != STREAM_TYPE_APPLICATION) {
>                       report_om_error(immOiHandle, invocation,

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to