author | zihao.zhu@oracle.com <zihao.zhu@oracle.com> |
Mon, 17 Oct 2016 09:22:53 -0700 | |
changeset 7116 | 24e5d18aa27c |
parent 6897 | 95d141a9085b |
permissions | -rw-r--r-- |
6897
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1 |
Avoid a bad free in the encoding handling logic |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
2 |
See: https://launchpad.net/ubuntu/+source/a2ps/+changelog |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
3 |
|
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
4 |
Index: b/lib/encoding.c |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
5 |
=================================================================== |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
6 |
--- a/lib/encoding.c |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
7 |
+++ b/lib/encoding.c |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
8 |
@@ -538,7 +538,9 @@ |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
9 |
{ |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
10 |
/* Find if there is a substitute for that font */ |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
11 |
res = pair_get (encoding->substitutes, font_name); |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
12 |
- if (!res) |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
13 |
+ if (res) |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
14 |
+ res = xstrdup (res); |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
15 |
+ else |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
16 |
/* No. Check if this font is supported */ |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
17 |
if (font_exists (job, font_name)) |
95d141a9085b
22834809 a2ps should be 64-bit
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
18 |
/* Avoid returning sth alloca'd */ |