Fix uninitialized variables
authorVolker Lendecke <vl@samba.org>
Tue, 29 Jan 2008 22:01:23 +0000 (23:01 +0100)
committerGerald W. Carter <jerry@samba.org>
Tue, 29 Jan 2008 22:24:59 +0000 (16:24 -0600)
response.extra_data.data is not initialized on the first error path

Found by the IBM checker
(This used to be commit e9b3115c85e3d04eeaa04bfa71972d393272afca)

source3/nsswitch/libwbclient/wbc_pwd.c
source3/nsswitch/libwbclient/wbc_sid.c

index b24e198bc5cdaba7d7c70d3c51db0dda28105eeb..b7febcce0c49cea777bd3d9151f72196dc4039d9 100644 (file)
@@ -209,16 +209,16 @@ wbcErr wbcGetgrnam(const char *name, struct group **grp)
        struct winbindd_request request;
        struct winbindd_response response;
 
-       if (!name || !grp) {
-               wbc_status = WBC_ERR_INVALID_PARAM;
-               BAIL_ON_WBC_ERROR(wbc_status);
-       }
-
        /* Initialize request */
 
        ZERO_STRUCT(request);
        ZERO_STRUCT(response);
 
+       if (!name || !grp) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
        /* dst is already null terminated from the memset above */
 
        strncpy(request.data.groupname, name, sizeof(request.data.groupname)-1);
@@ -254,16 +254,16 @@ wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
        struct winbindd_request request;
        struct winbindd_response response;
 
-       if (!grp) {
-               wbc_status = WBC_ERR_INVALID_PARAM;
-               BAIL_ON_WBC_ERROR(wbc_status);
-       }
-
        /* Initialize request */
 
        ZERO_STRUCT(request);
        ZERO_STRUCT(response);
 
+       if (!grp) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
        request.data.gid = gid;
 
        wbc_status = wbcRequestResponse(WINBINDD_GETGRGID,
index f5f553c4c6a3c8763a999ef4f8083e4f4d20899b..0519d8bf9f2c3c4808e590a25c8b1c2f9cc9e359 100644 (file)
@@ -311,16 +311,16 @@ wbcErr wbcLookupRids(struct wbcDomainSid *dom_sid,
        char *domain_name = NULL;
        wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
 
-       if (!dom_sid || (num_rids == 0)) {
-               wbc_status = WBC_ERR_INVALID_PARAM;
-               BAIL_ON_WBC_ERROR(wbc_status);
-       }
-
        /* Initialise request */
 
        ZERO_STRUCT(request);
        ZERO_STRUCT(response);
 
+       if (!dom_sid || (num_rids == 0)) {
+               wbc_status = WBC_ERR_INVALID_PARAM;
+               BAIL_ON_WBC_ERROR(wbc_status);
+       }
+
        wbc_status = wbcSidToString(dom_sid, &sid_string);
        BAIL_ON_WBC_ERROR(wbc_status);