Mercurial > octave
comparison liboctave/wrappers/uniconv-wrappers.c @ 32088:e2911d0176dc stable
uniconv-wrappers: Avoid freeing uninitialized pointer (bug #64182).
* liboctave/wrappers/uniconv-wrappers.c (octave_u8_conv_to_encoding_intern):
Initialize pointer with NULL that might be freed without assignment otherwise.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 12 May 2023 08:00:41 +0200 |
parents | f7206b6577c2 |
children | 212145b8e5f0 |
comparison
equal
deleted
inserted
replaced
32082:66ecc0d4d6ce | 32088:e2911d0176dc |
---|---|
65 if ((tocode[0] != 'u' && tocode[0] != 'U') | 65 if ((tocode[0] != 'u' && tocode[0] != 'U') |
66 || (tocode[1] != 't' && tocode[1] != 'T') | 66 || (tocode[1] != 't' && tocode[1] != 'T') |
67 || (tocode[2] != 'f' && tocode[2] != 'F')) | 67 || (tocode[2] != 'f' && tocode[2] != 'F')) |
68 padlen++; | 68 padlen++; |
69 | 69 |
70 uint8_t *u8_str; | 70 uint8_t *u8_str = NULL; |
71 const uint8_t *cu8_str; | 71 const uint8_t *cu8_str; |
72 if (srclen < padlen) | 72 if (srclen < padlen) |
73 { | 73 { |
74 u8_str = (uint8_t *) malloc (padlen); | 74 u8_str = (uint8_t *) malloc (padlen); |
75 memcpy (u8_str, src, srclen); | 75 memcpy (u8_str, src, srclen); |