Fix Coverity ID 462
authorVolker Lendecke <vl@samba.org>
Sun, 23 Mar 2008 16:32:46 +0000 (17:32 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 23 Mar 2008 17:28:23 +0000 (18:28 +0100)
source/rpc_parse/parse_buffer.c

index bb39a58c07d356b4d66506f822208aa7e839b786..63a73c4b7c7df347ef8f6b9e1c82ba7bab22d2a0 100644 (file)
@@ -374,8 +374,10 @@ bool smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16
                        return False;
        
                do {
-                       if (!smb_io_unistr(desc, &chaine, ps, depth))
+                       if (!smb_io_unistr(desc, &chaine, ps, depth)) {
+                               SAFE_FREE(chaine2);
                                return False;
+                       }
                        
                        l_chaine=str_len_uni(&chaine);
                        
@@ -402,10 +404,10 @@ bool smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16
                {
                        chaine2[l_chaine2] = '\0';
                        *string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size);
+                       SAFE_FREE(chaine2);
                        if (!*string) {
                                return False;
                        }
-                       SAFE_FREE(chaine2);
                }
 
                if(!prs_set_offset(ps, old_offset))