aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2016-03-14 02:28:33 -0700
committerLev Walkin <vlm@lionet.info>2016-03-14 02:28:33 -0700
commit034ee194f4d7d4b760cd5e0808a124d2b5ee005f (patch)
treeda536912f836aa03c5de483ce510964449f60557
parentf2b2f3766068fb87e5ad2c2827e730229fa7bd7f (diff)
no dereference before check
-rw-r--r--skeletons/OCTET_STRING.c12
-rw-r--r--skeletons/per_support.c2
2 files changed, 8 insertions, 6 deletions
diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c
index ece27a28..a8c0f7f3 100644
--- a/skeletons/OCTET_STRING.c
+++ b/skeletons/OCTET_STRING.c
@@ -1712,16 +1712,18 @@ OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr,
void
OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
- asn_OCTET_STRING_specifics_t *specs = td->specifics
- ? (asn_OCTET_STRING_specifics_t *)td->specifics
- : &asn_DEF_OCTET_STRING_specs;
- asn_struct_ctx_t *ctx = (asn_struct_ctx_t *)
- ((char *)st + specs->ctx_offset);
+ asn_OCTET_STRING_specifics_t *specs;
+ asn_struct_ctx_t *ctx;
struct _stack *stck;
if(!td || !st)
return;
+ specs = td->specifics
+ ? (asn_OCTET_STRING_specifics_t *)td->specifics
+ : &asn_DEF_OCTET_STRING_specs;
+ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
+
ASN_DEBUG("Freeing %s as OCTET STRING", td->name);
if(st->buf) {
diff --git a/skeletons/per_support.c b/skeletons/per_support.c
index 0d089f49..5ecdc2e0 100644
--- a/skeletons/per_support.c
+++ b/skeletons/per_support.c
@@ -12,7 +12,7 @@ per_data_string(asn_per_data_t *pd) {
static char buf[2][32];
static int n;
n = (n+1) % 2;
- snprintf(buf[n], sizeof(buf),
+ snprintf(buf[n], sizeof(buf[n]),
"{m=%ld span %+ld[%d..%d] (%d)}",
(long)pd->moved,
(((long)pd->buffer) & 0xf),