From 7e60e5991e97443044ae9c097131c84e9538cc42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Tue, 12 Nov 2013 13:41:49 +0100
Subject: [PATCH 45/47] pac: fix potential memory leaks
---
src/responder/pac/pacsrv_utils.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/responder/pac/pacsrv_utils.c b/src/responder/pac/pacsrv_utils.c
index a82320fcae3b0494e7b6b322428e3a17ed729b4a..53edcc286119aa4a315285827da96e5d157afec9 100644
--- a/src/responder/pac/pacsrv_utils.c
+++ b/src/responder/pac/pacsrv_utils.c
@@ -82,7 +82,7 @@ errno_t get_sids_from_pac(TALLOC_CTX *mem_ctx,
hash_key_t key;
hash_value_t value;
char *rid_start;
- struct ldb_result *msg;
+ struct ldb_result *msg = NULL;
char *user_sid_str = NULL;
char *primary_group_sid_str = NULL;
@@ -154,8 +154,8 @@ errno_t get_sids_from_pac(TALLOC_CTX *mem_ctx,
sid_str, NULL, &msg);
if (ret == EOK && msg->count == 1) {
value.ul = ldb_msg_find_attr_as_uint64(msg->msgs[0], SYSDB_UIDNUM, 0);
- talloc_free(msg);
}
+ talloc_zfree(msg);
ret = hash_enter(sid_table, &key, &value);
if (ret != HASH_SUCCESS) {
@@ -189,8 +189,8 @@ errno_t get_sids_from_pac(TALLOC_CTX *mem_ctx,
sid_str, NULL, &msg);
if (ret == EOK && msg->count == 1) {
value.ul = ldb_msg_find_attr_as_uint64(msg->msgs[0], SYSDB_GIDNUM, 0);
- talloc_free(msg);
}
+ talloc_zfree(msg);
ret = hash_enter(sid_table, &key, &value);
if (ret != HASH_SUCCESS) {
@@ -219,8 +219,8 @@ errno_t get_sids_from_pac(TALLOC_CTX *mem_ctx,
if (ret == EOK && msg->count == 1) {
value.ul = ldb_msg_find_attr_as_uint64(msg->msgs[0],
SYSDB_GIDNUM, 0);
- talloc_free(msg);
}
+ talloc_zfree(msg);
ret = hash_enter(sid_table, &key, &value);
if (ret != HASH_SUCCESS) {
@@ -251,8 +251,8 @@ errno_t get_sids_from_pac(TALLOC_CTX *mem_ctx,
if (ret == EOK && msg->count == 1 ) {
value.ul = ldb_msg_find_attr_as_uint64(msg->msgs[0],
SYSDB_GIDNUM, 0);
- talloc_free(msg);
}
+ talloc_zfree(msg);
}
ret = hash_enter(sid_table, &key, &value);
--
1.8.4.2