~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/lib/XIE/free.c

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Xorg: free.c,v 1.4 2001/02/09 02:03:41 xorgcvs Exp $ */
 
2
 
 
3
/*
 
4
 
 
5
Copyright 1993, 1998  The Open Group
 
6
 
 
7
Permission to use, copy, modify, distribute, and sell this software and its
 
8
documentation for any purpose is hereby granted without fee, provided that
 
9
the above copyright notice appear in all copies and that both that
 
10
copyright notice and this permission notice appear in supporting
 
11
documentation.
 
12
 
 
13
The above copyright notice and this permission notice shall be included
 
14
in all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
17
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
18
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
19
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
 
20
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 
21
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
22
OTHER DEALINGS IN THE SOFTWARE.
 
23
 
 
24
Except as contained in this notice, the name of The Open Group shall
 
25
not be used in advertising or otherwise to promote the sale, use or
 
26
other dealings in this Software without prior written authorization
 
27
from The Open Group.
 
28
 
 
29
*/
 
30
/* $XFree86: xc/lib/XIE/free.c,v 1.5 2001/12/14 19:54:33 dawes Exp $ */
 
31
 
 
32
#include "XIElibint.h"
 
33
 
 
34
#define CHECK_AND_FREE(_ptr) if (_ptr) Xfree (_ptr)
 
35
 
 
36
 
 
37
void
 
38
XieFreeTechniques (XieTechnique *techs, unsigned int count)
 
39
{
 
40
    unsigned i;
 
41
 
 
42
    if (techs)
 
43
    {
 
44
        for (i = 0; i < count; i++)
 
45
            CHECK_AND_FREE (techs[i].name);
 
46
 
 
47
        Xfree ((char *) techs);
 
48
    }
 
49
}
 
50
 
 
51
 
 
52
void
 
53
XieFreePhotofloGraph (XiePhotoElement *elements, unsigned int count)
 
54
{
 
55
    /*
 
56
     * NOTE: We do not free the technique parameters here.
 
57
     * Most of the technique parameters should be freed by the
 
58
     * client using Xfree (exception: EncodeJPEGBaseline and
 
59
     * EncodeJPEGLossless, see functions below).  This is so
 
60
     * the client can reuse technique parameters between photoflos.
 
61
     */
 
62
 
 
63
    unsigned i;
 
64
 
 
65
    if (!elements)
 
66
        return;
 
67
 
 
68
    for (i = 0; i < count; i++)
 
69
    {
 
70
        switch (elements[i].elemType)
 
71
        {
 
72
        case xieElemConvolve:
 
73
            CHECK_AND_FREE ((char *) elements[i].data.Convolve.kernel);
 
74
            break;
 
75
        case xieElemPasteUp:
 
76
            CHECK_AND_FREE ((char *) elements[i].data.PasteUp.tiles);
 
77
            break;
 
78
        default:
 
79
            break;
 
80
        }
 
81
    }
 
82
 
 
83
    Xfree ((char *) elements);
 
84
}
 
85
 
 
86
 
 
87
void
 
88
XieFreeEncodeJPEGBaseline (XieEncodeJPEGBaselineParam *param)
 
89
{
 
90
    if (param)
 
91
    {
 
92
        CHECK_AND_FREE ((char *) param->q_table);
 
93
        CHECK_AND_FREE ((char *) param->ac_table);
 
94
        CHECK_AND_FREE ((char *) param->dc_table);
 
95
        Xfree ((char *) param);
 
96
    }
 
97
}
 
98
 
 
99
 
 
100
void
 
101
XieFreeEncodeJPEGLossless (XieEncodeJPEGLosslessParam *param)
 
102
{
 
103
    if (param)
 
104
    {
 
105
        CHECK_AND_FREE ((char *) param->table);
 
106
        Xfree ((char *) param);
 
107
    }
 
108
}
 
109
 
 
110
 
 
111
void
 
112
XieFreePasteUpTiles (XiePhotoElement *element)
 
113
{
 
114
    XieTile *tiles= element->data.PasteUp.tiles;
 
115
 
 
116
    if (tiles)
 
117
    {
 
118
        Xfree (tiles);
 
119
        element->data.PasteUp.tiles=NULL;
 
120
    }
 
121
}